Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
19 votes
1 answer
76k views

How to deserialize a JSON String to Apex

How can I deserialize this json object: { "response": { "count": 1, "benchmark": 0.22567009925842, "requests": [ { "request": { ...
codeSlayer's user avatar
15 votes
3 answers
36k 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": "...
Nikola J.'s user avatar
  • 193
11 votes
1 answer
10k 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(). ...
Adrian Larson's user avatar
  • 148k
3 votes
1 answer
6k 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 ...
Philip Clark's user avatar
0 votes
1 answer
105 views

How to deserialize JSON?

I have an issue which I've been struggling with today. The JSON is returned back to me with a project Id as the key, this Project Id is dynamically generated and due to this I have not been able to ...
BreadMAN's user avatar
0 votes
1 answer
1k 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 ...
SfdcBat's user avatar
  • 4,721
19 votes
1 answer
1k 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 ...
Eric's user avatar
  • 53.7k
4 votes
3 answers
369 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-...
More Than Five's user avatar
4 votes
2 answers
6k 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 ...
govind123 raju's user avatar
3 votes
2 answers
8k 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]), ...
Semmel's user avatar
  • 2,192
2 votes
2 answers
415 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 ...
gNerb's user avatar
  • 9,343
2 votes
1 answer
872 views

How to loop trough second level deserializeUntyped Json String [duplicate]

PLEASE NOTE: deserializeUntyped not deserialize! I currently loop trough a jsonPayload which is working fine for the nodes of the first level.How can I achieve this for the node(s) of the second level ...
Thomas's user avatar
  • 2,284
2 votes
1 answer
10k views

System.JSONException: For input string

When ever i click on Upload Intent then works perfectly and i get response but when i click on status i get this json error, This is my VF, <apex:commandButton action="{!upload}" value="Upload ...
kishore's user avatar
  • 142
1 vote
1 answer
457 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 ...
Padam's user avatar
  • 55
1 vote
2 answers
5k 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&#x2F;04&#x2F;...
Venky's user avatar
  • 624
0 votes
2 answers
859 views

Is it possible to Generically deserialize a Json string wit nested arrays in Apex

I want to be able to Generically deserialize a Json string with nested arrays for a web-service, since the structure isn't known beforehand and kan change a lot. I did some reading a seems doable but ...
Thomas's user avatar
  • 2,284
0 votes
1 answer
1k views

How to dynamically get name of object JSON String

I want to create a generic webservice. As I understood going the way of using Schema.getGlobalDescribe() will result in performance issues. I decided to try using JSON Schema trough Custom metadata ...
Thomas's user avatar
  • 2,284
0 votes
1 answer
86 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 ...
Kamil Mieczakowski's user avatar
0 votes
0 answers
92 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 ...
SfdcBat's user avatar
  • 4,721
0 votes
1 answer
2k 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"},{"...
Padam's user avatar
  • 55
0 votes
1 answer
406 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": {}...
user69684's user avatar