Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
522 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....
1
vote
1answer
584 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
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: { "...
0
votes
2answers
202 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 = ...
0
votes
1answer
71 views

Error deserializing json array nullpointer exception

I receive this json through a request {"pay_CCIban":"XXX", "pay_bic":"YYY", "pay_names[]":["name one","name two"], "pay_extid":"extId"} I'm trying to deserialize it with this class global class ...
0
votes
2answers
116 views

Serialize and deserialize a list of Sobject for Future method

I am trying to pass a list Account records to a future method. Since future can only take primitives, I am planning to serialize and deserialize the Sobject. I tried below: List<Account> acList;...
0
votes
1answer
1k views

How to parse nested objects in JSON response

Im trying to parse the below JSON response: { "preferredLanguage":"en", "preferredLocale":"en_GB", "languages":{ "en":{ "langCountry":"en-bn", ...
0
votes
2answers
73 views

Deserializing JSON

I am having trouble deserializing the JSON request received. Below is the JSON format I receive, { header:{ worker count: 2}, Worker:{ name:emp1 }, ...
0
votes
1answer
58 views

Invalid Conversion Runtime Type List<> to Map<>

I understand I am getting this error on the map line but I do not understand why. As the method does return the list I am constructing. What am I missing about this exactly? The dataRequest starts as ...
0
votes
1answer
136 views

JSON Deserialize

I am not able to deserialize my json JSON { "Services.ServiceContract_SAM_APIResponse": { "Services.ServiceContract_SAM_APIResult": { "Services.row": [ { "...
0
votes
1answer
76 views

Deserialization using Apex class generated using JSON2Apex gives null for inner values

I have the following piece of code. @RestResource(urlMapping='/Update') global with sharing class OpportunityUpdate { @HttpPost global static void updateOpportunity() { RestRequest req = ...
0
votes
2answers
53 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> ...
0
votes
2answers
58 views

JSON deserialize test

In normal runtime everything seems to deserialize correctly but when I try to run a test class it throws the following error: System.JSONException: Unexpected character ('r' (code 114)): was ...
0
votes
1answer
63 views

Pulling values from inner curly brackets

I am trying to pull the values from a JSON response and have managed to get most of the values except the one I need which is nested in an inner set of curly brackets public class web_ser { @future(...
0
votes
1answer
78 views

deserializing of json using wrapper class in apex

I have following type of json { "itemsPerPage" : 1, "links" : { "next" : "" }, "list" : [ { "id" : "19623", "resources" : { "reports" : { "allowed" : [ "GET" ], ...
0
votes
1answer
99 views

How to Deserialize the Trigger old & newMaps in JSON

I'm trying to pass the old & newmaps as arguments to a future method using JSON method. I see the below error when it tries to deserialize the data. reference-Passing SObjects to Future |...
0
votes
2answers
233 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 ...
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":{...
0
votes
1answer
190 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, "...
0
votes
1answer
5k views

JSON deserialization problem; Invalid conversion from runtime type LIST<ANY> to LIST<type>

I'm running code in Execute Anonymous String responseLite = '[{"candidate_index" : 0, "delivery_line_1" : "address goes here", "input_index" : 0}]'; List<AddressVerification_Service....
0
votes
1answer
12 views

Deserialize based on Child Class Apex Type

I am trying to deserialize a a serialized string of a child class from a static method. I have tried referenced the childClass from the static method, but it can't find it because it's a static method,...
0
votes
1answer
21 views

deserialize a JSON and modify a single attribute in the list of Object

I have a JSON string as below from a http response. { "agreements": [ { "agreementId": "ag0", "publishedDate": "04-03-2016 00:00:00", "AgreementNumber":...
0
votes
3answers
151 views

Error: Malformed JSON: Expected '[' at the beginning of List/Set

JSON Response: { "caPerformanceRecordList": [ { "motorDealerID": "XL1HX", "dealerName": "Subaru Auto Dealer", "reportingPeriod": "2019-05-18", "...
0
votes
1answer
119 views

How to deserialize the following JSON to get the list of values? [duplicate]

I have used the code below to deserialize the json but throwing an error. Map<String,Object> root =(Map<String,Object>)JSON.deserializeUntyped(res.getBody())); "Callout error Invalid ...
0
votes
2answers
69 views

Is it possible to create a generic Map swapper?

I have a method: public Map<Object, Object> swap(Map<Object, Object> valueByKeyMap) { Map<Object, Object> keyByValueMap = new Map<Object, Object>(); for (Object key : ...
0
votes
1answer
56 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 ...
0
votes
1answer
251 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 ...
0
votes
2answers
327 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-...
0
votes
1answer
212 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
2answers
96 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 ...
0
votes
2answers
365 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
2answers
442 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":...
0
votes
2answers
178 views

Deserialize an object with an optional field

I am trying to deserialize a request body but need to allow one of the fields to be optional. RequestBody { Decimal someNumber; } RequestBody reqBody = (RequestBody)JSON.deserialize(req....
0
votes
1answer
422 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"},{"...
0
votes
1answer
40 views

Retrieving data from JSON

I have this JSON data From where i have to fetch the "id"` { "_embedded": { "users": [{ "id": "5d54e31886d2db014eefbf45", "email": "vinothk@hibizsolutions.com", ...
0
votes
1answer
121 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": {}...
0
votes
1answer
36 views

Restructure hierarchical data in a REST callout

I found contact data as JSON on the web that is not organized as the Contact sObject as the phone number is being stored as hierarchical data: please see https://api.androidhive.info/contacts/ for the ...
0
votes
1answer
274 views

Malformed JSON: Expected '[': how to deserialize JSON with REST API?

Error: Malformed JSON: Expected '[' at the beginning of List/Set I think I have incorrect JSON.deserialize for my object. How can I fix it? I don't use a wrapper. List<Account> accList = new ...
0
votes
1answer
1k 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
1answer
2k 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 ...
0
votes
1answer
768 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 ...
0
votes
1answer
52 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(); ...
0
votes
1answer
127 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": "...
0
votes
1answer
646 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
2answers
806 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 ...
0
votes
2answers
33 views

How to parse json response with multiple records and add it to list

I have a json response from third party system which is as below. { "returnCode": 600, "lineItems": [ { "id": 9762, ...
0
votes
0answers
26 views

JSON deserialization issues

I have reviewed a lot of the other deserialize issues and I keep running into problems. What I have been able to gather is that if I have a response coming back with a reserved word in the JSON, I can ...
0
votes
1answer
38 views

JSON deserializing not happening

I'm trying to deserialize a List of JSON objects in Apex. Here is the JSON being passed: [ { "Name":"TestUser1", "Interview_Information":{ "Interviewer":"JTA Test", "CandidateStage":"...
0
votes
1answer
291 views

Null object not so elegantly handled after JSON.deserialize()

According to this post, returning a blank list should handle nulls. But in my case it still complains that it's expecting something but found null. Here is my class: public class PersonProfile { ...
0
votes
0answers
54 views

Variables from inner class defined by JSON deserialization are coming across as null

I have a class, geolocAddress, that I created to deserialize some JSON using JSON2Apex. I really only need to access the variables from one inner class, Components, but when I try to retrieve the ...