Questions tagged [deserialize]

The tag has no usage guidance, but it has a tag wiki.

Filter by
Sorted by
Tagged with
16
votes
1answer
43k views

How to deserialize a JSON String to Apex

How can I deserialize this json object: { "response": { "count": 1, "benchmark": 0.22567009925842, "requests": [ { "request": { ...
10
votes
1answer
7k views

Why is String.valueOf(Blob) different that Blob.toString()?

I am working on a REST Service that will desiralize the request body and interpret it. My understanding was that calling String.valueOf(objectInstance) would just call objectInstance.toString(). ...
3
votes
1answer
4k views

JSON deserialize into wrapper class errors

I'm trying to set up integration to display quiz answers in a Visualforce page, but I'm having a lot of difficulty deserializing a JSON string (supplied via API call response) into a wrapper class ...
0
votes
1answer
270 views

Deserializing/Parsing the JSON response to an Apex class

am trying to parse the below JSON request to Apex class. The challenge here is that one of the node "match" in the JSON is suppose to be an array but the external system sends it as a String. I would ...
19
votes
1answer
846 views

Aura vs Apex - Deserialization and Interface discrepancy (Major rewrite with git repo)

Question rewritten and complete example code provided I am trying to write test methods for an aura implementation but am running into a roadblock where the JSON serialization/deserialization between ...
13
votes
2answers
23k views

Deserialize JSON to SObject

Following code is giving me common.apex.runtime.impl.ExecutionException String jsonText = '{"Data": {"attributes": {"type": "Contact"},"Id": "0036100000JUXKkAAP","Description": "","LastName": "...
1
vote
2answers
4k views

Is there any function to deserialize an JSON to an array in lightning component?

I have been using JSON.parse() function to deserialize JSON object, It is not working for special characters. For example, if the JSON contains a date it being converted as 2012/04/...
0
votes
0answers
68 views

Parse a String as an Array using System.JSONParser [duplicate]

AN external system for some reason sends a node in a JSON as a String instead of an array like below: "vr_sch": "[{"type":"Record","tableName":"hpd","SId":"868","frequency":"ONCE"}]" The Apex class ...
4
votes
3answers
276 views

Deserialising a DateString

I do: Date d = (Date)JSON.deserialize('2013-06-07T00:00:00.000Z', Date.class); System.debug('**********d = ' + d); I expect: *************d = 2013-06-07 00:00:00 I see: *************d = 2013-01-...
4
votes
2answers
4k views

How to parse XML data to JSON? How to deserialize XML to Apex class?

I Have Xml data as Follows String Data_XML = '<?xml version="1.0" encoding=""?> <book><price>100</price><Items>2</Items> </book>'; I wanted to deserialize ...
3
votes
2answers
4k views

Deserializing an Account throws an error

I have this very simple example that serializes and deserializes the first Account found: System.debug((Account) JSON.deserialize( JSON.serialize([SELECT Id, Name FROM Account LIMIT 1]), ...
2
votes
2answers
350 views

Lightning Component Issues Deserializing Integers

This is a result of my previous question Lightning component action responds with internal server error which I was finaly able to troubleshoot and resolve on my own. My original issue was that my ...
2
votes
1answer
1k views

How to serialize the JSON response?

i'm trying to convert the json response as sObject(Case). but i'm little confusion to map external sys fields with sobject fields this is my JSON response : {"result":[{"short_description":"Can'...
1
vote
1answer
112 views

Apex Error Message : JSON Exception Error: No content to Map

The previous Question is linked here: Apex Class Error Message: System.JSONException: No content to map to Object due to end of input I have updated the code If I use the below code where String is ...
0
votes
1answer
478 views

Apex Class Error Message: System.JSONException: No content to map to Object due to end of input

I am getting an Error in Apex when i try to Deserialize the JSON Response. System.JSONException: No content to map to Object due to end of input My JSON Response in debug Log is: [{"recId":"1"},{"...
0
votes
1answer
65 views

Deserialising JSON

I am trying to deserialise the following JSON object and get it to display on a visualforce page. However the fields displayed by the page are blank. I debugged the code to the point where I know I ...
0
votes
1answer
127 views

Malformed JSON: Expected '{' at the beginning of object while deserializing JSON..!

For this JSON When I tried to serialize using the class generated from json2Apex I am getting the error "Malformed JSON: Expected '{' at the beginning of object" JSON: { "controllerValues": {}...