Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
202 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
435 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
3k 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
375 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
126 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
393 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
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]), ...
1
vote
2answers
155 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 ...
1
vote
3answers
840 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
473 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
358 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
830 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
628 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
132 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
757 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
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 ...
2
votes
1answer
1k 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
186 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
909 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
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(). ...
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
22k 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
187 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
120 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
881 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
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 ...
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"...
2
votes
2answers
3k views

What XML support salesforce provides in apex

(i) Is it possible to directly serialize/deserialize sObject record to xml in apex code? (ii) Is it possible to serialize/deserialize apex object to/from xml?
2
votes
1answer
2k views

Changing property names when serializing JSON [duplicate]

Is there any way to set the name of the serializable field? I'm trying to work with JIRA webhooks and I ran into an issue where their request package contains a field that is a protected keyword in ...
2
votes
1answer
2k views

Handling hyphens in JSON deserialization

I am trying to use public REST API that that has hyphens in variable names. Apex does not support variable names with hyphens. JSON2Apex tool generates kind of strange class as well. I was facing ...
0
votes
2answers
772 views

How to use salesforce reserved keywords in json deserialization in apex rest services [duplicate]

I'm new to apex rest services.Normally in Apex rest services the input json body automatically deserializes to apex class object. but my json body contains reserved key words.For Rest services ...
2
votes
1answer
661 views

Calling JSON.deserialize() throws “System.NullPointerException: Attempt to de-reference a null object”

I'm trying to use the System method JSON.deserialize(jsonString, apexType) to deserialize the body of an ApexRest POST request. My code compiles, but at runtime I'm getting a System....
1
vote
1answer
56 views

Replace original record with another on during After / Before Insert

Imagine the user clicks a standard New button of a custom objects, populates some fields (in a Standard Layout) and then clicks save. He then is redirected to the View page of this new record, but is ...
1
vote
1answer
579 views

How to access the get; set of a inner class after using JSON.deserialize in salesforce apex

So I am getting a response as jSon for which I created the class: public with sharing class TurboBrigeResponse { public responseList responseList{get;set;} public String authToken{get;set;} ...
1
vote
1answer
966 views

Deserialize JSON to Map - EchoSign REST API response help

I am making a call to the EchoSign REST API and I need to get the signing URL of the most recently signed document using an EchoSign query. I am using the following: HttpRequest req = new HttpRequest(...
2
votes
1answer
8k views

Access sObject list variables in Javascript

Question: I need to create list of sObjects in Javascript. Let's assume accountWrapperList is a list of (Account + checkbox) defined in controller. You can access this list in your javascript if you ...
0
votes
1answer
416 views

Deserialize BulkAPI XML response to QueryResult

Is there anyway to deserialize bulkAPI response(XML) to Standard QueryResult object? I am using C# as backend and PartnerAPI of SFDC. See below XML. I am getting "queryResult xmlns='http://www.force....
1
vote
0answers
166 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: { "...
1
vote
1answer
58 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 ...
2
votes
1answer
8k 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", ...
3
votes
1answer
2k 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" : "...
13
votes
1answer
41k views

How to deserialize a JSON String to Apex

How can I deserialize this json object: { "response": { "count": 1, "benchmark": 0.22567009925842, "requests": [ { "request": { ...