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

5
votes
1answer
67 views

How to build a Apex Class to handle a JSON format in my example

I want to build a custom sync framework and combine serval object's data to a Json string. For example List<Account> accounts = [select Id, Name, ... from Account where ...]; The sOBject is ...
0
votes
1answer
77 views

I am not able to parse string as it needs double quotes format

Please find the code. Apikey= ApexPages.currentPage().getParameters().get('Apikey'); jsonstring='{FirstName:"}'+Apikey; public void parseJsonString(){ JSONParser parser = ...
1
vote
1answer
33 views

Salesforce System Error

I'm getting FATAL_ERROR System.UnexpectedException: Salesforce System Error: 2029807441-269060 (565110838) (565110838) From this code: The line that throws the error has a comment next to it. ...
2
votes
1answer
21 views

How do I access elements from Json?

If I do String json = api.doRetrieve(endpoint); then I get back a json string. This is an array of objects. How do I get it to where I can do obj.someproperty in Java and access it? I'm doing this: ...
1
vote
1answer
28 views

Sample 3rd Party APIs to practice Salesforce Apex callouts

Are there any sample 3rd party APIs that I could make use for practicing Salesforce Apex callouts.
2
votes
1answer
45 views

Triggered Send - passing nested data

Is there any good solution for sending nested (not flat) data to triggered send? Suppose I want to send a transaction confirmation email. Ideally, I would like to send a json (or json-like) object ...
6
votes
2answers
53 views

Is there any logic to how SFDC serializes classes to JSON?

I'm working on documentation for a number of APEX REST API endpoints which returned user-defined types. I'm struggling to write the documentation since the order of how things are serialized into JSON ...
0
votes
1answer
19 views

parsing JSON to class and transforming on-the-fly

I have an @RestResource listening for a JSON string to be passed to me. I then use a JSON2Apex class to parse the JSON into a usable format. However, I receive dates in "seconds", an example of ...
0
votes
2answers
69 views

Deserialize nested JSON

I'm trying to deserialize a nested JSON string and store the values so that I can insert them into a visualforce page. Something like this tutorial here. However, I'm getting the error ...
2
votes
1answer
63 views

Apex JSON.serialize() with null values (RELOADED)

I need to serialize a list of SObject without omission null values. This string I need for a later usage in JavaScript. Structure is crucial, because I need to construct a table out of it. The ...
1
vote
2answers
166 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
104 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
60 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: ...
3
votes
1answer
57 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
41 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
25 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
60 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
26 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
127 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
98 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
59 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
116 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
171 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
85 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
128 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
106 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
99 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
103 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
21 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
350 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
37 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
14 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
111 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
174 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
119 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
147 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
60 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
403 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
373 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
163 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 ...
5
votes
3answers
223 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
15 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
45 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
47 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
190 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
43 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
77 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
534 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
103 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
248 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 ...