Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
32 views

Deserialize Datetime from Custom Settings in Lightning Component

Is there a helper utility for Lightning components to convert values from Datetime objects into a deserialized value? I have two Datetime values in Custom Settings... My_Start_Date__c My_End_Date__c ...
2
votes
1answer
835 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\":{'+ ----...
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:...
2
votes
1answer
912 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
23 views

Dynamic Deserialization and merging of JSON Attachment

I have a requirement 2 merge old and newly created JSON attachment. There are no duplicates. The JSON have below format : { "productConfigurationId": "a06cdeghijklmnoABC", "attributesByAttrDefId":...
2
votes
2answers
345 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
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 ...
2
votes
1answer
2k 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: { "...
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 ...
1
vote
2answers
564 views

Is it possible to convert Map<Object, List<Object>> to Map<Id, List<SomeConcreteSObject>> without a loop?

As a Salesforce developer, I am frequently working with Maps and am looking to abstract the process of generating maps from SObject lists. I've created the following helper class: private class ...
1
vote
1answer
2k views

JSON.deserialize return null values

I'm trying to Test my Rest Web Service class. I want to simulate the process by taking a JSON and deserialize it to a class - Instead to create all the data by my self. But for some reason - all my ...
1
vote
1answer
331 views

How can I deserialize JSON with a (.) in the variable name?

I am getting following payload and am not sure how to deserialize it properly. Please note: I already used the JSON2Apex and the provided code did not work for me. Also, the actual payload is pretty ...
1
vote
1answer
458 views

Access date time in milliseconds from nested soql query

This SOQL statement SELECT name, (SELECT From__c, To__c FROM Trip__r) FROM Account limit 1 will return Smith [{"From__c":"2013-11-25T15:15:00.000+0000","To__c":"2013-11-27T15:15:00.000+0000"},{"...
1
vote
1answer
200 views

JSON DeSerialization Help?

I am currently working on an integration with other systems and I have the JSON coming back in the below format. { "searchDocumentsResponse": { "documentsIndexInfo": [ { ...
1
vote
3answers
874 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
363 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 &...
1
vote
1answer
191 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= ...
1
vote
2answers
45 views

How to deserialize list with map to wrapperclass

I have a string which I am trying to deserialize to a wrapperclass / object. But get the error: Expected Map<String,String> but found [line:1, column:3] Wrapperclass global class ...
1
vote
2answers
119 views

Handle unknown properties with typed JSON.deserialize()

I am looking for an elegant and unhacky way to handle deserialization of a JSON into an Apex type where some of the properties are known and some are not. Assumption: At least for now the unknown ...
1
vote
1answer
48 views

Convert object as string to json

I have an object which is converted to string in a text field. How can I convert this to a JSON string. String of object: Profile:[UID=, crmId=0000o00002XXXXxXXX, email=top@top.com, firstname=null, ...
1
vote
1answer
28 views

Json Parse Issue

I have very simple -sample class for the following json which I kept in custom label for simplicity. Sample JSON Which I have kept in Custom Label for simplicity : Label Name : Smple_Resp { "...
1
vote
1answer
853 views

JSON deserializeuntyped function is shorting my response string

I have the following string as a response from a HttpResponse variable using its getBody() function: {"data":{"chat":[{"speaker":"Speaker 0","startTime":"0.16","message":"for technology positions so ...
1
vote
2answers
347 views

deserialize and then Iterating over a map

I'm creating a map in javascript I have a key as String and Value as SObject here is the function for the map var oMap = {}; function addValueToKey(key, value) { oMap[key] = finAccountMap[key] ||...
1
vote
1answer
692 views

Having trouble deserializing a JSON string of Objects

I'm trying to handle a JSON response..the format it comes in is not the best but I can't change it..Ive used JSON2APEX and can access the object values individually but I need to loop through them ...
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
410 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=...
1
vote
1answer
494 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
122 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
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 ...
1
vote
1answer
59 views

HttpGet and Callout: is not a valid Salesforce ID for the type

I get Item's list from 1 organisation and want to insert them like Another Items in 2 organisation. But it try to insert it with Id. How can I fix that? Error: System.DmlException: Insert failed. ...
1
vote
1answer
4k views

Parsing of JSON where a key contains spaces

I am trying to deserialize this response { "invoiceList":[ { "totalPrice":5.5, "statementDate":"2011-10-04T16:58:54.858Z", "lineItems":[ { ...
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 ...
1
vote
1answer
499 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
367 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). ...
1
vote
1answer
4k 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 de-...
1
vote
1answer
2k views

JSON.deserialize not ignoring unknown properties.

I'm trying to deserialize a JSON response from an API. Let's say the JSON looks like this: { "pages": 3, "this_page": 1, "products": [ { "id": "1", "...
1
vote
1answer
7k views

JSON Deserialize Byte Array

I'm porting over a rest client from .NET to Apex and in the class that gets initiated by deserializing the JSON response, there is a byte[]. C# Example: public class MyResponse { public ...
1
vote
1answer
24 views

JSON Objects into string type

I have a doubt regarding the JSON deserialiser method. So when we deserialise a JSON response or JSON file. Is there a way to make every attribut and value into a string type rather than its original ...
1
vote
1answer
52 views

How to deserialize JSON string with serialized object as map value?

I have a JSON string which the value of 'clueContent' is a serialized JSON String. When I try to deserialize this JSON string to the resp2Obj inner class, it raise an error with message: 'System....
1
vote
1answer
106 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 ...
1
vote
1answer
27 views

Get value from deserialised JSON

I have a JSON string which looks like this: jsonstring = {"XX":["Blah blah"]} I need to get the 'Blah blah' into a string variable. How do I do this? Tried doing it this way, but all that returned ...
1
vote
2answers
759 views

Deserialize JSON Body into two different Lists of own classes

I'm writing an REST PUT request that takes in an array of Careers and Degrees from the body and converts them to inner classes within the RestResource class. However, when I am attempting to ...
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;...
1
vote
2answers
164 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
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 ?
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
974 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(...
1
vote
0answers
187 views

JSON time fields

We have a problem with deserialize and serialize salesforce time fields Since Json and salesforce time fields both consist of "colon" we need to replace with a special character before deserialize ...
1
vote
0answers
77 views

How to minimise CPU usage doing JSON to Apex conversion across 70,000 lines?

Please help me finalizing Apex Wrapper Classes for parsing a very large JSON. JSON shown below comprises of product configuration data from ERP. (This JSON is usually 60k to 70k lines; it is scaled ...