Questions tagged [deserialize]
The deserialize tag has no usage guidance, but it has a tag wiki.
212
questions
0
votes
2
answers
529
views
How to deserialize json list, error: Invalid conversion from runtime type List<ANY> to List<or_leadsJSON>
I an trying to deserialize a Json string to use in my callout but get the error
Invalid conversion from runtime type List<ANY> to List<or_guestsJSON>
Callout
HttpResponse response = ...
1
vote
0
answers
244
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 ...
1
vote
1
answer
41
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
{
"...
0
votes
2
answers
762
views
how to get a value after from result callout
I have the following where the result format of the callout is the following:
[
{
"uid": "72852a55-5be3-496c-904c-fc3fd261f0a4",
"name": "Responseev Agency"
},
{
"uid": "66852a55-...
1
vote
1
answer
901
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 ...
0
votes
1
answer
451
views
Parsing different JSON bodies String vs List
Hi I have a Json body that can either send over a list vs a string. Right now I have it set to just capture a string "type"
public class PackageInformation{
public String location {get;set;}
...
0
votes
2
answers
232
views
How to deserialize my json result? [duplicate]
I'm calling one rest API and it's working properly but I'm not able to deserialize it's reesult.
Below in mentioned my code and what response in I'm getting,I want city value in city variable and ...
-1
votes
1
answer
874
views
How to add duplicate fields in list in JSON deserialize method?
I need to parse this JSON and store services in a list but getting exception in deserialize due to duplicate field. Can someone help what I need to change to make this work?
I have generated the class ...
4
votes
2
answers
2k
views
Is it possible to JSON.deserializeUntyped directly to DateTime without information about field is DateTime?
I wonder if it is possible to JSON.deserializeUntyped directly to DateTime type.
How can I check if deserialized Object in Map has type of DateTime? I am curious is it possible, because Object in ...
0
votes
2
answers
733
views
Test Class Only Covers the Callout Method but the rest of the methods isn't
I have Mock callouts in my test class but the test class didn't cover some of the codes. It has been solved before but there were changes to my code and now my test class isn't working. The scenario ...
-1
votes
1
answer
2k
views
Deserialize multiple level object JSON
So I am working with Google calendar data in the following format:
{
"kind": "calendar#events",
"etag": "\"thEtag\"",
"summary": "samuel.reyes@genko.com",
"updated": "2018-08-20T18:11:13.081Z",
"...
-1
votes
1
answer
128
views
Getting JSON String FATAL_ERROR System.TypeException: Invalid conversion from runtime type List<ANY> to Map<String,ANY>
I am suppose to be getting this JSON string but I am stuck with this error FATAL_ERROR System.TypeException: Invalid conversion from runtime type List to Map
This is the JSON String:
{
"...
4
votes
1
answer
2k
views
Deserializing a list of jsons
I am trying to deserialize a list of jsons.
If I have only one json like so '{"apple":"green"}' I can parse it using JSON.deserializeUntyped:
Map<String, Object> input = (Map<String, ...
0
votes
1
answer
333
views
JSON deserialize with custom token
I need to deserialize an json where the token has special characters, but is not working as expected, it's not passing through the token and comparing to assign, am I forgetting something?
controller:...
1
vote
1
answer
3k
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
1
answer
3k
views
Deserialize JSON string to custom Apex class
I'm building an API to show data in a Visualforce page. After I created the classes and the callout it responses with a JSON string. For now I use a mock JSON string to test my deserialize function.
...
0
votes
1
answer
190
views
JSON Deserialize
I am not able to deserialize my json
JSON
{
"Services.ServiceContract_SAM_APIResponse": {
"Services.ServiceContract_SAM_APIResult": {
"Services.row": [
{
"...
0
votes
1
answer
58
views
JSON to Not Inserted Custom Objects to Map
I have a JSON response I receive from an endpoint, it is then deserialized, and all of the objects are stored in a custom object list (stored in the list variable "scope").
I am trying to place this ...
1
vote
2
answers
750
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
votes
1
answer
94
views
How do i deserailize this json string
Can Any one help me in deserializing this json string:
"(ActivityHistory:{AccountId=0011a00000qWdtzAAC, Id=00T1a00001m4m99EAA, WhoId=0031a00000u3iXlAAI, Subject=Call, Status=Completed, Priority=...
1
vote
1
answer
6k
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":[
{
...
9
votes
1
answer
3k
views
How to deserialize JSON to a class where the same variable name has different data types?
I am trying to deserialize some JSON to a class using JSON.deserialize.
My JSON looks like this
{
"type": "GeometryCollection",
"geometries": [
{
"type": "Point",
...
0
votes
2
answers
91
views
JSON key set to List conversion using deserializeUntyped
I am trying to extract the 'key' from a json an insert each key to a list (array).
Map<String,Object> obj = (Map<String,Object>) JSON.deserializeUntyped(reqestObj);
List<String> ...
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 ...
0
votes
1
answer
5k
views
Displaying JSON response data from a wrapper class onto a VF Page
I'm currently working on a small app, to allow to better understand RESTful Webservices and how to consume them. The app connects to a RESTful API, and I need to find a way to display the JSON ...
2
votes
1
answer
1k
views
APEX Deserializing/Parsing RESTful JSON Webservice Response
I'm trying to get JSON data from a RESTful webservice into SFDC.
My attempts have failed as I keep getting the following error:
System.JSONException: Malformed JSON: Expected '{' at the beginning ...
2
votes
1
answer
345
views
deserialising JSON best practice/efficiently
I have the following JSON structure
{
"PLU":{
"high":"N/A",
"low":"N/A",
"percentChange":"0",
"baseVolume":"0",
"quoteVolume":"0"
},
"1ST":{
"high":"0.00033386",
"low":"0.00033386"...
1
vote
1
answer
970
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
...
10
votes
2
answers
1k
views
Unfamiliar Syntax
I came across the following code online:
@future(callout=true)
public static void runWarehouseEquipmentSync(){
Http http = new Http();
HttpRequest request = new HttpRequest();
request....
10
votes
2
answers
1k
views
How to Deserialize AggregateResults?
Is it possible to deserialize AggregateResults? If not, why?
When I try it the regular way, all my aggregate results are empty:
List<AggregateResult> arList = [SELECT Name FROM Account GROUP BY ...
5
votes
2
answers
736
views
Copy the properties from one instance of an Apex Class to another
I am attempting to copy the properties from one Apex class instance to another (without hard coding the property names). See the below example:
public class Post{
public String name ...
6
votes
1
answer
198
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
1
answer
3k
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 ...
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 ...
1
vote
1
answer
1k
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
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 ...
2
votes
1
answer
3k
views
Parser JSON array inside JSON array
I am facing issue with parsing jsonArray below
{
"name": [
{
"actions": "test",
"Items": [
{
"Components": [
{
"details": {
...
1
vote
1
answer
984
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
1
answer
2k
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
1
answer
721
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
1
answer
74
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
1
answer
4k
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
1
answer
747
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
1
answer
607
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
2
answers
929
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
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 ...
0
votes
0
answers
221
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
2
answers
806
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":...
4
votes
2
answers
5k
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
1
answer
3k
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":{...