JSON, or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs. It is used primarily to transmit data between a server and web application, as an alternative to XML.

learn more… | top users | synonyms

1
vote
2answers
16 views

System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set when deserializing JSON object in apex

I'm trying to pass an array of strings from JavaScript to apex. I am initially converting the array into a JSON object and then stringifying the object and passing it into my apex code as a string. So ...
0
votes
0answers
11 views

Kendo Grid with datatype : json in Salesforce

Am developing a web page which uses kendo grid to populate the list of employees. Visual force page : <apex:page controller="Employee_Prav" sidebar="false"> <apex:includeScript ...
2
votes
1answer
40 views

JSON Serialize Anything

Sometimes as quick and drity debugging/introspection I leverage System.assert(false, JSON.serializePretty(<target>)) but it does not always work depending on target, ex: ...
2
votes
0answers
26 views

Setting mm_workspace with spaces in the filepath

I am setting up the Mavensmate Sublime plugin and need assistance setting the mm_workspace. I need this variable set as /Users/Name 1/Google Drive/Salesforce/workspace Here's what I currently have ...
1
vote
3answers
31 views

Converting Date from API response to Salesforce Date

I have a string field in an API response (JSON format) which is meant to be a date. The response field is below: "due":"/Date(1385841600000-0800)/" How can I convert this to an apex date?
1
vote
0answers
17 views

Deal with relationships/associations in JSON response using deserializeUntyped

I am parsing JSON returned from a web request using the deserializeUntyped method. The response contains data from a couple of different models and the relationships are arranged as follows: { ...
2
votes
1answer
24 views

Storing json as a String field is giving wrong value

I have been developing an Apex Trigger where I build a json string from an incomming Event. What I do is serialize the event into the json at first, then deserialize it as a Map and add to it some ...
1
vote
1answer
20 views

Deserialize and reserialize SOobject

i have an object like this: evticket__c et = [Select Id from evticket__c where Id =: id limit 1]; then i serialize it likethis: String obj = JSON.serialize(et); is there a way to create a new ...
1
vote
1answer
37 views

Apex: Get value from first element of Map

I am receiving the following JSON for a web service: { "count" : 1, "posts" : { "1234567" : { "id" : "1234567", "private" : false, "message" : "New post on Monday Jan 5th", ...
1
vote
1answer
51 views

Parse dynamic JSON with Apex

I am receiving the following JSON as a result of a web callout: { "count" : 1, "posts" : { "1234567" : { "id" : "1234567", "private" : false, "message" : ...
0
votes
0answers
27 views

Difference between Apex Heap Size and JSON heap size

Helllo, I am getting a specific error of "JSON string exceeds heap size limit" . I can not find reference specific to JSON related to heap size. I know we have Email Heap size of 36 MB, while ...
0
votes
1answer
60 views

JSON structure to insert multiple Account records in one REST API call

As per the documentation i understood that we can create account in the following way. Example for creating a new Account curl https://na1.salesforce.com/services/data/v20.0/sobjects/Account/ -H ...
2
votes
1answer
90 views

How to deserialize a JSON String to Apex

How can I deserialize this json object: { "response": { "count": 1, "benchmark": 0.22567009925842, "requests": [ { "request": { "id": 537481, ...
-1
votes
2answers
50 views

Write Test class for custom controller having wrapper class that makes a HTTP callout [closed]

Hello All Can anyone please help me to write test class for my custom controller. Below is my custom Controller. public class InsertDataInToNewShopCtrl{ public InsertDataInToNewShopCtrl(){ ...
3
votes
1answer
92 views

scheduled apex to query and create new sObject

I am currently working on creating a scheduled apex to query an external json case objects and insert these objects in salesforce. I am quite new to this framework and quite stuck. The below is a how ...
4
votes
0answers
65 views

deserializing JSON to object: different behavior in unit test vs API?

So let's say I've got a class that looks like this: public class APIParams { public String name; public String category; public Boolean taxable = false; } Then I have a ...
2
votes
1answer
68 views

How can I Deserialze JSON Object and save them to salesforce

I have the following JSON reponse format. I would like to save only specific information on salesforce i.e. all the user details, description, zip code, location, request_status, space and state: { ...
0
votes
1answer
61 views

Trigger to make @future callout to the Data.com match API

My company uses data.com premium. We want to create a trigger that will update a lead based on company information since the out-of-the-box functionality only matches based on the lead. (contact). I ...
0
votes
0answers
20 views

Weird Response from SFDC on calling create Resource URL

I have a JAVA program to use the Create REST Resource. It's working fine and able to create the records. However, I am getting a weird Json reponse from salesforce after record created. ...
0
votes
1answer
125 views

JSON deserialization problem; Invalid conversion from runtime type LIST<ANY> to LIST<type>

I'm running code in Execute Anonymous String responseLite = '[{"candidate_index" : 0, "delivery_line_1" : "address goes here", "input_index" : 0}]'; ...
0
votes
0answers
27 views

Test if String is JSON without actually deseriazing / inserting data

I want to find out if a given String "would" be deserializable without actually doing it. Is there a way to do that ?
0
votes
0answers
12 views

Convert <sf:> tags to another formats

I am new to SF so I don't know much more about it, I am getting a record from SF api for a call details of a number so it returning me data in tags like I am unable to get data from these tags, ...
1
vote
1answer
87 views

Having trouble deserializing a JSON object that contains SF Ids

I am using an geocoding API called Geocodio to process a batch of addresses. I felt I had a good handle on deserializing JSON arrays, but am having trouble deserializing a response that doesn't have ...
1
vote
1answer
95 views

How to deserialize json string to Apex

I have a requirement, where I have to select some value from multipicklist and then send this json response to the server. There are 2 scenarios: 1st Scenario: when we are selecting and ...
3
votes
1answer
81 views

Give lookup field External Id in JSON request

I am using standard create Rest resource to create an contact record in sales force. In json , I am matching the Label name in request with SFDC custom field name , so SFDC do the mapping for me ...
1
vote
1answer
76 views

deserializing JSON returns a null ojbect

I'm trying to deserialize a JSON response into a list, so that eventually I can iterate through the list and create new contacts from the response. This is my first time working with APIs and JSON, ...
1
vote
1answer
48 views

JSON.deserializeUntyped is not working with map set, error : Method does not exist or incorrect signature

I am trying to convert JSON data into a map set, but I tried so hard without any result. Here is my code Map<String, String> m {set; get;} m = (Map <String, String>) ...
1
vote
1answer
153 views

How to convert SObject to JSON in APEX or the reverse

I have a stored data as JSON and I want to convert it to object in order to fill a <apex:pageBlockTable> with it. Is there a library I can use like GSON library ? Or what is the best thing to ...
1
vote
1answer
167 views

REST API: How to insert values for picklist and lookup field types?

Introduction Hello, I'm working on synchronising data from a MySQL database into Salesforce using the REST API. I've got as far as inserting basic text values, but for complex field types such as ...
3
votes
2answers
128 views

Json Getting Sorted when serialize the wrapper class object

I have to send JSON request to external system. I have created a wrapper object and defined the variable. However, When I am serializing the wrapper class object , it's sorted the JSON request. I ...
4
votes
3answers
137 views

Problems parsing JSON in APEX

I am calling a REST endpoint (of another Salesforce instance) and I am getting the following response: [{ "attributes": { "type": "Job__c", "url": ...
0
votes
0answers
14 views

Batch apex error “Apex CPU Time limit exceeded error” [duplicate]

I have created batch apex class to insert records into salesforce but i got an error i.e."CPU time limit exceeded error" Please help me to solve this error. global virtual class InsertProductData ...
2
votes
1answer
35 views

JSON.createGenerator(true)

I am creating a JSON generator that returns the created object to be parsed in a different method. However when I am creating a field using the writeStringField method of JSON with a value of null, it ...
-1
votes
1answer
43 views

why we need to serialize and deserialize

why we need to serialize and deserialize? Why don't we save the value directly into database with out serialize. What is the benefit for doing serialize. I know that by doing serialize it will get ...
1
vote
1answer
125 views

Batch apex error in apex job : Exceeded max size limit of 3000000

Using Batch apex i am trying to Insert new records in to custom object from json string in salesforce from API url. When my batch apex class run i got this error in apex log. please explain me
0
votes
0answers
30 views

Batch Processing: “Read Timed Out” Error

I am trying to add records from API URL using batch apex in salesforce. I got an error while running batch apex. Please help me to solve this error.
0
votes
2answers
66 views

building an sObject from a json string in VF page

How can I deserialize a JSON string into an sObject in a VF page? I don't want to use a controller so I'm looking for the right approach to do this on the client side only. Any ideas?
1
vote
1answer
324 views

Using Batch apex Insert new records in to custom object from json string in salesforce

I am trying to insert json data in to salesforce objects. Json string is too large so i am using batch apex to insert data. For this I had written apex class i didn't got any error But records not ...
2
votes
1answer
68 views

getting the query result in json format when working with sforce.connection.query

I have this javascript code in a VF page where I'm trying to fetch records from the DB. I'm getting back an xml format but I need it as a json format. Is there a way to get the result records in json ...
0
votes
1answer
155 views

Insert new records in to custom object from json string in salesforce

I am working with the new JSON Parsing functionality, I have API URL that contain json string.I have created one VF page that displays JSON string data in pageblock table in record format from API ...
0
votes
0answers
34 views

using apex trigger to write in G Drive : Authentication process

I develop an apex trigger that creates folders and a file in my company's Google Drive. I have issues with setting the authentication process. Here's google's guide on how to do it : ...
0
votes
2answers
905 views

How to make <apex:inputText> field as read-only using js/jquery

I have a requirement like, when the end user clicks on the list of users, then an input text field should get populated. the input field should be non-editable. lets say the input field value is ...
3
votes
1answer
238 views

Apex Webservice returning **Unexpected parameter encountered during deserialization:**

I have a webservice, and I'm trying to send a List of Apex classes to my SFDC org. Before I even get anywhere in my POST method Salesforce just returns an error. Sample JSON: {"FieldParser": { ...
3
votes
1answer
24 views

Sending Contact Information To External Site With AJAX

I am working on a website that is using Salesforce for membership management purposes. Salesforce is the single repository for membership information and needs to be able to send membership ...
0
votes
0answers
48 views

How to name number property for JSONGenerator

In the PayPal REST API, there is a credit_card object which has a property called number. Unfortunately, "number" is a reserved keyword in Apex, which means that I can't simply name my property number ...
0
votes
3answers
129 views

Json response getting truncated when getting from Salesforce

I am facing a peculiar problem where, I am querying an external webservice using HTTP Rest APIs, and getting a Json response. Now the problem is when the response payload is large, a chunk of data is ...
0
votes
1answer
158 views

How to send Empty field value as blank (Not Null)

Apex Code: List<order_batch__c> bcList = new List<order_batch__c>(); bcList= [select Or_invoiceadd1__c,Or_invoiceadd2__c,Or_invoiceadd3__c,Or_invoiceadd4__c from order_batch__c ...
0
votes
1answer
144 views

Getting error while deserialize

I am trying to deserialize a jason request but getting error that Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at ...
1
vote
0answers
36 views

What is the best approach to store 10 MB JSON and perform CRUD in SFDC?

I have a business case to design a solution for a web based excel like (UI, formulae, etc..) system. I researched and finalized to go with JQuery.Sheet. However, there is no recommendation laid ...
2
votes
2answers
52 views

list changes the column order of records while debugging

Apex: List<order_batch__c> bcList = new List<order_batch__c>(); bcList= [select Or_sub_po_number__c,Or_customer_PO_Number__c, ...