Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
6
votes
1answer
147 views

JSON.deserialize() for User records wont work

I'm trying to deserialize a received user record on a JSON format. TO achieve this I'm using JSON.deserialize() but when I specify the User class the compiler throws the following error: Save Error:...
11
votes
1answer
2k views

How to deserialize into interface type when concrete type is unknown

As a follow up to this question: I am essentially trying to deserialize a JSON object into an Interface Type. Unfortunately we cannot deserialize using an Interface as the ApexType and must know ...
1
vote
1answer
5k 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 ...
0
votes
1answer
984 views

Unexpected parameter encountered during deserialization:

I am trying to create a rest endpoint. My JSON Body:- { "Name":"First Widget" } Apex Class:- @RestResource(urlMapping='/Widgets/*') global class WidgetController { @HttpPost global ...
19
votes
1answer
896 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 ...
1
vote
1answer
2k views

Parser JSON array inside JSON array

I am facing issue with parsing jsonArray below { "name": [ { "actions": "test", "Items": [ { "Components": [ { "details": { ...
1
vote
1answer
568 views

refrain from unescaping special characters when receiving restcontext json?

I've set up an @RestResource class for receiving an external JSON webhook through an @httppost class, which is working great, but when retrieving the content of the request through RestContext.request....
3
votes
1answer
792 views

How to parse YAML object in Salesforce Apex

I get a YAML string from REST service response in Apex code and I look for some similar way how to parse it and convert to collection of Salesforce objects. For instance, I get such YAML as string: ...
2
votes
1answer
701 views

Json Deserialization

EDIT 2: Apparently Apex has no idea what escaping character is... after I removed manually all '\' from that JSON, it worked. I know this question was asked tens of times, but so far nothing works ...
0
votes
1answer
56 views

How do I extract the value of the token from an HTTPRequest?

I've managed to login to the web and have received a token, but I can't seem to get my JSON.deserialize to give me just the token value. What should I be doing? string sToken = response.getBody(); ...
2
votes
1answer
3k views

JSON deserialize a list of a list

I'm trying to deserialize the following JSON which I'm obtaning from the Google Cloud Platform Translation API: { "data": { "detections": [ [ { ...
1
vote
1answer
536 views

JSON.deserializeUntyped problems with long list

I have this string s1 : {"iss":"backend","nbf":499071708,"iat":1499071708,"exp":2499071708,"Server":{"Version":"1.0","Identity":"backend"},"Data":{"ContentList":["AzEuMFveOpUnBpFTJ5yYdqdZxJs=","...
1
vote
1answer
404 views

Deserialising JSON with a '.' variable

I am attempting to deserialise a JSON response with some variables that Salesforce is having a problem handling because there is a '.' in the object name (as well as a '.' in some variable names). ...
0
votes
2answers
442 views

Trigger to fetch data and send it to field

This is probably really easy but I am completely new to Salesforce and struggling to find any tutorials on this. I have managed to deserialise a JSON object into the following wrapper: public class ...
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
0answers
208 views

Selectively Parsing a JSON file

I am attempting to parse MatterMark's API, but I am planning to do so selectively, picking only the value pairs that are relevant. The example JSON response is available to be viewed in MatterMark's ...
0
votes
2answers
461 views

How to Deserialize the JSON response if it contains fields as test__c?

I am stuck as I have a response in the format shown below. Am not able to deserialize the fields appended with __c. "ReviewDetail": [{ "Request_Id__c": "", "Material_Requested_No__c":...
3
votes
2answers
4k views

System.TypeException: Invalid conversion from runtime type Map<String,ANY> to Map<String,String>

I have the following Program which gives me the following error: System.TypeException: Invalid conversion from runtime type Map<String,ANY> to Map<String,String> The program which I ...
0
votes
1answer
2k views

How to deserialize JSON to sObject?

I have following code and I'm trying to deserialize json array to list of sObjects, but I'm getting following exception without any message: System.JSONException: String dzejson = '[{"attributes":{...
7
votes
1answer
2k views

deserializeStrict method: bug?

The documentation about the deserializeStrict method in JSON class is (emphasis added): All attributes in the JSON string must be present in the specified type. If the JSON content contains ...
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'...
3
votes
2answers
438 views

PHP Toolkit 20.0 (Enterprise) Upsert/Update Custom Object - deserializer not found

I'm using PHP Toolkit 20.0 (Enterprise) and the latest WSDL. Partner also fails for me. I can successfully create (using PHP Toolkit create) objects of this type. All my attempts to Update or Upsert ...
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&#x2F;04&#x2F;...
0
votes
1answer
131 views

De-serialized Json to Account fields

I am using the REST API to get responses from Data.com. I am able to de-serialize the response, but couldn't find a way to assign it to account fields. A sample response is below: { "entityType": "...
1
vote
1answer
490 views

JSON deserialise doesn't give the full string

When deserializing a JSON string to List<Object> using JSON.deserializeUntyped( resParams ) the list received is incomplete: {Address=null, BillingAddress=2509, CompanyId=632, County=null, Fax=...
3
votes
2answers
5k 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]), ...
1
vote
2answers
212 views

Dealing with single or multiple information on JSON deserialization

It is well known that it is possible to convert a JSON dictionary to an object using Apex. But as I'm trying to do so with a JSON that is returned from a webservice, I'm facing an issue while trying ...
2
votes
3answers
1k views

Default values for Wrapper variables not set

i am stumbled upon a issue and questioning why i didn't do a strong learning in oops. Below is a small snippet which is giving me the issue, i have a wrapper class built by json2apex tool. It is a ...
1
vote
1answer
573 views

getChildElement element failing null pointer exception

I have the below XML response which I am trying to parse through XML parser. But I am facing error i.e null pointer exception in debug log for the line: if(objXMLNode.getChildElement('...
1
vote
1answer
395 views

how to deserialize a Json to two lists in Apex?

I am passing the trigger.old & trigger.New values from the trigger to batch class through JSON. In the class while deserializing the JSON i am getting only one list. How can i get two lists(old &...
2
votes
2answers
1k views

Trailhead Apex Super Badge JSON Parsing

Working on the Trailhead Apex Super Badge.... There is a section that requires writing a rest callout that returns a chunk of JSON that you are to use to update Product2 records with. Reduced Chunk ...
2
votes
1answer
852 views

JSON DeserializeUntyped Error Invalid conversion from runtime type List<ANY> to Map<String,ANY>

sample JSON string : '{'+ ' \"count\":\"1\",'+ ' \"querycount\":\"1\",'+ ' \"ranking\":\"adaptive\",'+ ' \"mindPage\":{'+ ----...
0
votes
1answer
701 views

Deserialize JSON value

Scenario : Deserialize the JSON format data using wrapper class. I have JSON data and wrapper class for the JSON. I want to see value for one of the property in inner class of the wrapper class. But ...
0
votes
1answer
134 views

Scheduled Apex Class Testing Issue

I am trying to test a scheduled class in apex, but upon running the test method it gives me the following error: System.JSONException: Unexpected character ('0' (code 48)): was expecting double-...
3
votes
0answers
832 views

How to access deserialized nested SObjects

I am implementing a custom REST API to support upserting a related set of records, similar to the Salesforce composite REST API. Main reason for that is because I want all DML operations to be part of ...
4
votes
2answers
5k 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 ...
2
votes
1answer
2k views

JSON.deserialize for Date.class returning a wrong date

I am passing a serialized date through JavaScript using Remote Action. In Apex I deserialize this string to a Date but the date returned is not what I am expecting. Here's my code: Date ...
2
votes
1answer
3k views

System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set while deseriliasing json Payload

> I have resolved the issue updating answer for my own question thanks for response Stack-exchange great help everytime : > > > 1.Malformed JSON: Expected '[' > > Answer:...
1
vote
1answer
235 views

Complex Json deserialize using JSON.deserializeUntyped

How to de-serialize following array of response from the url??I have to pass time stamp in the URL as follows:Tried Json to apex too but as it is post method can't use that. String startdate= ...
2
votes
1answer
958 views

JSON.deserialize with arrays with one to many elements

I am consuming a REST service with APEX. Here is a response sample: { "createQuoteOutput": { "response": { "quoteNumber": 945, "temporaryQuoteNumber": "T8652" }, "...
2
votes
0answers
56 views

Q: Using Certificate impacts Lightning Connect results

I have setup a Lightning Connect to provide reference access to data behind company firewall. We use SOA Gateway tool to publish external web services (Odata 4.0 format), and I have been successful ...
10
votes
1answer
8k 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(). ...
2
votes
3answers
1k views

Convert SObjects containing child/parent records into a map

How can the following list of records be serialized/deserialized into a map or collection? Account[] accs = [select id, name, custom_parent__r.name, (select lastname, firstname from Contacts) from ...
13
votes
2answers
25k 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": "...
0
votes
1answer
201 views

Need to deserialize the json

We need to deserialize the json and assign it to a wrapper class.. { "facet_fields": { "CandidateStatus": [ "Actively Looking Qualified", 477, "Passive Headhunt", 441, "...
1
vote
1answer
127 views

Malformed JSON - Help creating wrapper Class/Controller

I keep getting Malformed JSON: Expected '[' at the beginning of List/Set error. Can someone please fix my wrapper class and controller for this JSON response to deserialize it? JSON: { "DataID"...
1
vote
2answers
2k views

What is the best way to create XML from a custom object and use that xml to create records of another custom object?

I have two custom objects . How to transfer the records from one custom object to another using xml ?
5
votes
0answers
910 views

JSON parsing to Visualforce page difficulties

Following my previous question here I've been dealing with some pretty crappy JSON for an assessment submission and trying to display it in a VF page as a table, ultimately with questions, available ...
3
votes
1answer
5k 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 ...
3
votes
2answers
2k views

Process JSON Array

Can someone tell me how to process JSON Array in an Apex REST resource class ?. My input to the HTTP post method will be like as follows. [ { "Name":"1 A" }, { "Name":"1 B"...