Skip to main content

Questions tagged [deserialize]

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

Filter by
Sorted by
Tagged with
-1 votes
3 answers
41 views

Unexpected parameter encountered during deserialization: Name

Unexpected parameter encountered during deserialization: Name @RestResource(urlMapping='/Account/*') global with sharing class MyRestResource { @HttpDelete global static void doDelete() { ...
Rahul's user avatar
  • 1
1 vote
1 answer
30 views

How to Correctly Exclude Checkout Day in Daily Rate Calculation with AMPscript?

I am using AMPscript in Salesforce Marketing Cloud to parse serialized JSON data for hotel reservations. Each entry contains start and end dates along with a daily rate. I need to calculate and ...
Matt Black's user avatar
1 vote
0 answers
53 views

Callback not executing after json deserialization

I'm running into a strange problem. The code is completing fine and sending the request/getting response back, handling the response correctly. I am just unable to show the "Success" toast ...
ThatGuy's user avatar
  • 85
1 vote
1 answer
639 views

JSON.serialize() Map<String, Object> changes Map structure

I have a Map<String,Object>() which I am trying to store in a text field for a subsequent asynchronous operation. My idea was for the following async operation to query for this map and re-use ...
Arthlete's user avatar
  • 4,957
0 votes
1 answer
95 views

Deserializing is giving null values from wrapper classes

Hi All I am trying to deserialize the below response but getting values null every time. Wrapper class used public class APIResponse{ public cls_InstantIDResponseEx InstantIDResponseEx; class ...
David Mycka's user avatar
  • 1,327
0 votes
1 answer
88 views

put(field, value) method from SObject class throws System.SObjectException: Illegal assignment from String to Datetime

I have encountered the error System.SObjectException: Illegal assignment from String to Datetime and I can't find what is the reason for this error. The context is as follows. I have a class with the @...
Tzinm's user avatar
  • 21
0 votes
1 answer
106 views

Need help with JSON deserialize

JSON deserialize is not working. however, data is coming from LWC in DATA parameter @AuraEnabled public static string saveProductLineItems(Object data) { system.debug('LINE 18 data:'+ ...
SF Dev's user avatar
  • 15
2 votes
2 answers
523 views

Is JSON deserialization in Apex case sensitive?

If I have to deserialize a response like this: { "Property1" : "value", "Property2" : "value2" } Do I have to respect the case of the property names? I would ...
fred's user avatar
  • 3,414
0 votes
1 answer
1k views

Deserialize Very Specific JSON into Map <String, Object>

I have searched internet for hours and can't find how to convert my specific JSON: [{"_id":"55d66226726b611100aaf741","replacement":false,"quantity":5,"...
ApexNoob's user avatar
0 votes
1 answer
688 views

How can I retrieve particular data from json string using Apex? [closed]

When individuals fill out a survey through an outside source, the JSON data gets stored in Salesforce as a Long Text Area in a custom Survey__c object (about 25,000 characters). There are hundreds of ...
user avatar
2 votes
1 answer
498 views

How to deserialize a list<Object> without using indexes

I have this JSON: { "Details":{ "Customer Input": "Type Here", "Input Status": 0, "CumulativeValues":[ { ...
Ravi Kumar's user avatar
2 votes
1 answer
242 views

Deserialized JSON with Invalid Ids are ignored silently

Below String has invalid Id for Lookup(Contact). But it's deserialized without an error, which I hope is okay. My concern is Update DML is run without any error and ignoring the invalid value instead ...
Pasan Eeriyagama's user avatar
0 votes
1 answer
946 views

Can you deserialize just part of a JSON into an object?

This is more of a concept question than an actual code question but can you deserialize just part of a JSON String into an object or do you have create a class and a sub class for the whole thing. So ...
Jebert's user avatar
  • 15
-1 votes
1 answer
104 views

System.QueryException while System.debug() for a deserialized Object

My question is similar to this. I'm trying to create a Case and process few child task records from a REST API Call. REST API Endpoint POC: But when I executed this as below, I get error System....
Pasan Eeriyagama's user avatar
0 votes
1 answer
1k views

Error: No field name specified on column for sobject of type Document__c when deserializing JSON

After a callout, I am getting a JSON response as: { "totalSize": 1, "done": true, "records": [ { "attributes": { "type": &...
Rahul Allada's user avatar
0 votes
1 answer
1k views

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

I'm getting error in the following apex method: System.TypeException: Invalid conversion from runtime type List to Map<String,ANY> Please find the apex method: @AuraEnabled(cacheable=true) ...
Rose 's user avatar
  • 123
0 votes
0 answers
41 views

Probblem with list from api json deserialized

Im trying to get data from an api, I already deserialized the json, But when I try to get the data in visualforce just shows me 1 value, and I dont get it, I ve been reading the documentation but ...
noebrenes's user avatar
0 votes
0 answers
187 views

Code Coverage for JSON Deserialize Typed

I am having trouble getting test code coverage for a JSON response that I'm deserializing typed, and am not exactly sure how to properly test. Any advice would be appreciated! Here is the code I'm ...
happylittletrees's user avatar
0 votes
1 answer
1k views

JSON.deserialize throw exception

I am trying to deserialize a string into a inner class. the I can transform that class into the real salesforce class, because the variables names are not the same ones than the real class. But when I ...
Alexis's user avatar
  • 129
1 vote
1 answer
521 views

Not able to resolve Malformed JSON: Expected '{' at the beginning of object

I am having a simple JSON as like below {"Stagename":"Prospecting","OppName":"MM - Opportunity","CloseDate":"2022-10-08","Phone":&...
SFDC buddy's user avatar
0 votes
1 answer
246 views

How to deserialize this to get only the value 3.2

I have the Wrapper class, and the testwrapper class, but in my callout class i cant get it to only get out the value: 3.2 this the is api url: https://data.ssb.no/api/v0/no/table/11117 This is the ...
Thesulli's user avatar
0 votes
1 answer
567 views

Handle with different type of params RestContext deserialize

We have a REST service that gets data from external service to salesforce. The data can be achieved using RestContext.request.requestBody.toString(); So I create an inner class to deserialize the ...
Salvation's user avatar
  • 1,189
1 vote
0 answers
521 views

JSON deserialization of datetime - accepted format

I have an Apex REST API endpoint prepared that accepts DTO object. One of the fields in this object is of Datetime type. I was surprised that JSON.deserializeStrict accepts datetime to be of following ...
neff's user avatar
  • 1,416
1 vote
0 answers
605 views

Issue in deserializing of List<Messaging.SingleEmailMessage>

I would like to send email with future apex. Because of future method can't access list of Messaging.SingleEmailMessage, I'm serializing it and pass string to future method. But when I deserialize it, ...
Vonahclom's user avatar
1 vote
1 answer
3k views

How to get the field value from object. I am using deserializeUntyped

I am trying to get the field value from the object. If I loop through the object it looks like Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(RestContext.request....
NBR's user avatar
  • 269
1 vote
2 answers
5k views

Access Object property in APEX

Given the next code: Object deserializeResponse = JSON.deserializeUntyped(response); System.debug('DESERIALIZERESPONSE' + deserializeResponse); //DESERIALIZERESPONSE: {proposalIds=null, ...
CPS's user avatar
  • 365
0 votes
1 answer
1k views

Enable Map type to hold Integer, String, Boolean, Map, List... objects? (But not generic Object)

I'm attempting deserialize a list of a custom object in Apex, but got an error: FATAL_ERROR System.JSONException: Apex Type unsupported in JSON: Object This is because my ContactPostBack class ...
Ian's user avatar
  • 9
0 votes
1 answer
196 views

Deserialize dynamic json. Im handling reserved words fine but struggling to break free of hardcoding deserialization of __c and __ strings

Im deserializing a JSON (that has both reserved apex words and other uncompilable strings having 'organizer__' and '__c' ) in Apex. Ive been using a compiled class-based deserialization approach and ...
Peter Noges's user avatar
  • 1,140
1 vote
1 answer
311 views

Declaration of Data Types Apex

I'm a new learner in Apex and I have a question about declaration of variables(A map in this case) and its Data type. I've been working with integrations and REST callouts and spend a long time when ...
Rosangelys Reyes's user avatar
0 votes
2 answers
1k views

Get values in a List from JSON

I'm doing a REST API call to get the global value set and trying to deserialize the JSON result to get the picklist values in a List. Here is the JSON: { "size": 1, "totalSize"...
RJ12's user avatar
  • 1
8 votes
1 answer
2k views

Apex Json deserialize issue

I have observered an strange behaviour on JSON deserialize As per documentation deserialize(jsonString, apexType) If the JSON content contains attributes not present in the System.Type argument, such ...
NITHESH K's user avatar
  • 2,535
0 votes
1 answer
2k views

JSON deserializeUntyped causing exception for a JSON data string

JSON deserializeUntyped is causing trouble and I could not understand why it would convert a Array of data to something that is neither an array nor a similar string? To reproduce I am executing this ...
VarunC's user avatar
  • 6,000
0 votes
2 answers
728 views

Struggling to Deserialize this JSON in Apex [duplicate]

Here is my initial apex that currently functions and will return json. public class samCall { @AuraEnabled public static String samQuery(string accountDuns) { HttpRequest req = new ...
User_11223344's user avatar
1 vote
2 answers
3k views

Posting a JSON to the Salesforce REST API

I am trying to post the JSON to the Salesforce REST API, JSON getting posted to the REST service is like below [{"manager":"ABC", "name":"XYZ", "...
user81642's user avatar
  • 687
-1 votes
1 answer
206 views

Help with JSON.deserialize

@AuraEnabled public static String clone(Group__c destinationGroup) { Savepoint sp = Database.setSavepoint(); try { Group__c dest = (Group__c)JSON.deserialize(...
Juliana's user avatar
1 vote
1 answer
461 views

How to test json.deserializeUntyped in trigger

I have a platform event trigger that takes in a json string which contains an array of objects. My postman test call looks like this: "testCodeList__c":"[{\"testCode\":\&...
Candice O's user avatar
1 vote
1 answer
468 views

Issues and inconsistencies with Datetime deserialize and Datetime.parse()

I recently came accross this issue with Datetime deserialization. When using JSON.deserialize() with a random numeric value, the Datetime instance is created in a strange format, however, for the same ...
Ruiter Gripp's user avatar
0 votes
0 answers
2k views

Deserialize JSON to Object given an JSON String and an sObjectApiName

I created a generic LWC using a lightning-record-edit-form where user specifies sObjectName and fields to display as parameters and the edit form will display those. <lightning-record-edit-form ...
Z33dawg's user avatar
  • 1,421
2 votes
1 answer
1k views

How to loop trough second level deserializeUntyped Json String [duplicate]

PLEASE NOTE: deserializeUntyped not deserialize! I currently loop trough a jsonPayload which is working fine for the nodes of the first level.How can I achieve this for the node(s) of the second level ...
Thomas's user avatar
  • 2,310
1 vote
1 answer
4k views

Ho to dynamically deserialize untyped a JSON with list

I have a JSON payload which is changing a lot so I want to create a way to dynamically deserialize the payload. My starting point is that the payload will consist of max 5 nested lists 5 levels deep. ...
Thomas's user avatar
  • 2,310
0 votes
1 answer
427 views

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

I am trying to dynamically deserialize a jsonstring (fieldmaplevels wil also be in custom metadata settings) but get the error: Error: Invalid conversion from runtime type List to Map<String,ANY>...
Thomas's user avatar
  • 2,310
0 votes
3 answers
857 views

How to manage both single and an array of json reponse from the same external system?

I have a situation where when I make a callout I get a single json response like this: { "Person": { "Infomration": { "IndividualInformation": { ...
nSv23's user avatar
  • 554
3 votes
2 answers
326 views

How to deserialize object with nested query in a simply way

I have a JSON of object with nested query and I do not want to use JSON.deserializeUntyped and map values manually. Is there any easy way to do it? For example: Sobject object = (Sobject) JSON....
Ferhat Özsavran's user avatar
0 votes
1 answer
700 views

Json deserialize System.NullPointerException: Attempt to de-reference a null object

I am trying to deserialize a json string and get the fieldtypes but get an error on the valueType. I am trying to simulate a Json request from postman to send a Post with a list of accounts. I dont ...
Thomas's user avatar
  • 2,310
0 votes
1 answer
2k views

How to dynamically get name of object JSON String

I want to create a generic webservice. As I understood going the way of using Schema.getGlobalDescribe() will result in performance issues. I decided to try using JSON Schema trough Custom metadata ...
Thomas's user avatar
  • 2,310
0 votes
2 answers
1k views

Is it possible to Generically deserialize a Json string wit nested arrays in Apex

I want to be able to Generically deserialize a Json string with nested arrays for a web-service, since the structure isn't known beforehand and kan change a lot. I did some reading a seems doable but ...
Thomas's user avatar
  • 2,310
2 votes
1 answer
112 views

Why does deserializeUntyped interpret Strings starting with digits as Integers

This code List<String> ls = new List<String>{'32', '4text', 'text5'}; Object obj; for (String s : ls){ try{ obj = JSON.deserializeUntyped(s); System.debug(s + ' ...
Emmanuel BRUNO's user avatar
-1 votes
1 answer
978 views

Better way to do the JSON.deserializeUntyped to avoid cognitive complexity

I have use-case to call an external web service response in a Batch class. I have desterilized and build the Wrapper from the response like below, Sample Response { "status": "OK&...
Hariprasath's user avatar
2 votes
0 answers
185 views

Custom object protected visibility failing JSON parser

My custom object in a DE org with a namespace has its visibility set to protected: Only Apex code in the same namespace can see the type. The name of the type and the record are visible if they're ...
Mossi's user avatar
  • 3,986
0 votes
0 answers
20 views

How to remove unwanted attributes from a JSON [duplicate]

I have deserialized a JSON but the values are null. I suppose the issue here is the "Configurations". How can i remove/modify this so as the deserialization gets the proper values? JSON {&...
Christos's user avatar

1
2 3 4 5