Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

JSON, or JavaScript Object Notation, is an open standard format that uses human-readable text to transmit data objects consisting of attribute–value pairs. It is used primarily to transmit data between a server and web application, as an alternative to XML.

1
vote
1answer
69 views

parse json response into name value pair

I have a json string , and i want it to be converted into name value pair json string. My actual string: {"payload":[{"YearlylCostPercentage":"4.6", "TotalRepayment":"120000","PropertyMarketValue":...
0
votes
1answer
17 views

JSON with backslash for CURL. Not able to generate Apex request class

I have a request JSON that other system has given to use. It looks like below: { \"list\": [ { \"m1\": \"tval\", \"fill\": { \"tool\": \"4535\" }, \"respfield\": ...
0
votes
1answer
24 views

Invalid conversion from runtime type ERROR

I'm trying to parse json response.. but keep getting this error Invalid conversion from runtime type List ANY> to Map String,ANY> Map<String, Object> MapLv3 = new Map<String, Object>()...
0
votes
1answer
14 views

Cant get the 1st row from JSON Parsing array

Im trying to get the participants data from API response.. //Level 1 Map<String, Object> MapLv1 = (Map<String, Object>) JSON.deserializeUntyped(parser); ...
0
votes
2answers
29 views

Using While loop for API callout

Im trying to test if I can request an API without timeout or reach the sfdc api callout limit.. I want to loop the request because the API only show the response for the 1st 25 records of each page ...
-1
votes
2answers
17 views

Formatting Json Response string to date in lightning component

I am working on a requirement for making API call getting the response and showing it on lightning component. My Json responce for one of the field is nextPeriodEndDate=20170406. I need to make it ...
2
votes
1answer
162 views

How to read JSON that contains field that can have different types

I am writing a callout in Apex with returns a JSON file with a field that does not have a consistent type. The JSON returned is quite complicated, so I have been trying to read the JSON with a Apex ...
1
vote
1answer
31 views

How to convert Json string with adminbooster and call a value

I am newbie trying to find a wordflow which makes it easy to convert JSON strings to apex I used adminbooster but get for example public cls_0 0; public class cls_0 { public cls_0 0; throws an ...
1
vote
1answer
39 views

Parsing Using JSON2Apex

Im trying to use the JSON2Apex to get the parsing class for my API response.. I only need the metrics data for each userId, but I cant get the variable and the system always giving error Variable ...
0
votes
2answers
51 views

Learn Parsing JSON

Im trying to get values from API request.. there`s 2 user data from the response and I want to get the data of each user and put it on the list.. but my code only store the last user data from the ...
0
votes
1answer
39 views

how to read this dynamic JSON

We used to deserialize the JSON when we know the object type . but this JSON is dynamic and I have to get the object name,fieldname and its values and store it in any collection where I can reuse it ...
0
votes
2answers
44 views

Add a new key-value to a json string

The scenario is as follow, I got a json which was converted to a string, I need to add to that json another key-value pair. I assume it requires to convert the string back to json, how would that ...
1
vote
0answers
24 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 ...
0
votes
1answer
19 views

Consume Date/time Iso 8601 timestamp in salesforce Datetime field

Im trying to parse an ISO 8601 timestamp value consumed in a JSON data format to a DateTime field value in salesforce. Class 1: if ((fieldStatus == ‘normal’) || (fieldStatus == ‘overwritten’)) { try ...
0
votes
2answers
20 views

Working with a generic object (not sObject)

I have a JSON string that I'm working with and want to deserialize and reference in Apex. The Problem is that the structure of the JSON is somewhat flexible. For Example, it could look like: { ...
0
votes
1answer
14 views

Illegal assignment from List<or_guestsJSON> to or_guestsJSON

I an trying to write a testclass for a JSON object but het the error: Illegal assignment from List to or_guestsJSON. How do I annotate the list in my testclass? Class public class or_guestsJSON ...
-2
votes
2answers
35 views

Need to get data from specific part of the JSON String

I have a field which has the JSON string. I just need to populate a part of that string into different field is that possible? log__c = JSON={"eventPayload":{"units":1.00,"name":"D-00889","...
1
vote
1answer
14 views

Method does not exist or incorrect signature: void parse(String) from the type or_propertyJSONTest

I am new to apex callouts and trying to do some JSON parsing. I used the online tool https://www.adminbooster.com/tool/json2apex which worked great. I got a class and a testclass from the ...
1
vote
1answer
24 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
2answers
25 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
29 views

Java Json formating not wokring ok

I have a program which read a csv file (1.2 mil) records, and then using batches , sent a json request to marketing cloud to create records. The right format(working ) format of json is [{ "...
0
votes
1answer
30 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
1answer
25 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;} ...
2
votes
1answer
26 views

POST a record from Org1 to Org2 with JSON and Map

I need to post created record from Org1 to Org2. I want to "put" my JSON into Map and just "open" Map in another Org. Needed result: fields from new Org1 Object's record = fields from new Org2 Object'...
0
votes
0answers
22 views

JSON_PARSER_ERROR in REST POST: Convert Picklist value from Org1 to String or Picklist value in Org2

All my values transferred good, but it's just Strings. When I try to post Picklist value into Text field I get this in debug msg: [{"message":"Unexpected parameter encountered during deserialization: ...
0
votes
1answer
41 views

System.NullPointerException: null argument for JSONGenerator.writeStringField() in POST Method

I have a custom Obj, and try to realize a POST method. But I get an Error: System.NullPointerException: null argument for JSONGenerator.writeStringField() What is wrong here? public static ...
0
votes
1answer
34 views

Mass Update Records - AWS S3

Currently, I utilize an AWS endpoint that returns a small JSON response based on my request. I am considering updating all of my records (300,000+) daily. My AWS counterparts can generate a JSON ...
0
votes
1answer
29 views

Read and manipulate Data Extension rows with JS in CloudPages

I am trying to retrieve around 2,500 rows from my Data Extension into a CloudPage so I can use it for some dynamic forms using JS. I would like to know what would be the best way to retrieve this ...
0
votes
0answers
21 views

Issue with the JSON object serialize [duplicate]

I am retrieving the list of all the fields and trying to serialize. Using the code snippet below allfieldNames contains around 400 fields but Data >>> contains information related to only 100 random ...
0
votes
2answers
38 views

Help Parsing JSON Body

Im trying to get the Id and Name from JSON Body that I requested, and put the value into custom object { "id": "ab24ddb8-f1ef-4cca-ae72-9f20f5975332", <-- THIS "name": "App Dev Account", <-- ...
0
votes
0answers
14 views

Mock an AggregateResult to test class [duplicate]

I'm trying to create a test class to test and cover a method that receive an AggregateResult list as parameter. I need some data of closed cases of last month. So I decided to create a "fake" data of ...
1
vote
1answer
18 views

Why is my Lightning:Tree component not displaying anything when fed Valid JSON?

Today I have been attempting to make a lightning:tree that accurately reflects a nested list of custom objects, and it feels like I am most of the way there, but can't quite get the tree to actually ...
0
votes
1answer
80 views

Unexpected character ('a' (code 97)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]

I have a batch class which makes a call out to an api within the same org (the rest resource was developed by a 3rd party supplier and I cannot see its source code) Anyway, as per the supplier the ...
0
votes
1answer
85 views

System.JSONException: Unexpected character ('1' (code 49)): was expecting comma to separate OBJECT entries

"sourceMessage": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><error code=\"VALIDATION_FAILED\"> <failure cause=\"INVALID_VALUE\" field=\"Status\" value=\"NotDefined\...
1
vote
1answer
33 views

Apostrophe in Data Extension comes back as gobbledygook

I have a page making an ajax call to the function below. The Description field has apostrophe's in it. They look fine in the data extension, but when ampscript grabs them from the DE, they look like ...
1
vote
0answers
17 views

Custom Activity runningModal. How to trigger only runnnigModal by clicking, without the runningHover

I want to trigger the runningModal by clicking on it without the usual flow of, first the hover appearing and clicking More Details button. The same it works for Data Extension activity so I think it'...
0
votes
2answers
29 views

How to handle multiple type of json in one parser class?

I am expecting two separate jsons in case of success and failure. In case of success I get a nested json whereas in failure I get a simple json mentioning status : failed so my class I used to ...
1
vote
1answer
79 views

How to use a JSON inside an apex class?

Main Class: @RestResource(urlMapping='/updateFaturamento/*') global class contractFat { public class ContractJSON { public List<Contract> Contract; public class ...
0
votes
1answer
14 views

How to store rest response data into Salesforce custom object as records

I have created REST service which is fetching prospect data from pardot and now I want to store it into Salesforce's custom object. I have some fields inthis object which I need to map from the ...
5
votes
3answers
215 views

JSON Parser getCurrentToken()

I have a JSON string that I want to parse out. I have use the below code many times but for whatever reason this time it is not working. Can anyone poke any holes in this logic? Or point out why this ...
1
vote
1answer
98 views

Set.contains() not working

My set contains custom JSON elements. When i try to use set.contains() method to check if the set has the JSON element it fails. MY JSON DATA: public uJSON(Id id,String name, Boolean manager,Id ...
-1
votes
1answer
27 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 ...
1
vote
2answers
73 views

Getting null for inner classes in complex JSON deserialization

I am trying to parse a nested JSON and have generated the apex code using JSON2Apex as below: global with sharing Class ServiceUpdates { @HttpPost global static void updateservice()...
0
votes
1answer
29 views

RTF File in Apex

Can anybody point me in the right direction for handling RTF files in apex? I'm making a REST request which is returning a JSON response containing RTF encoded text, example below, and I'm unsure of ...
0
votes
0answers
13 views

Is there a way to solve this problem when I leave the data out of the cols part because I have the label type as text?

Is there a way to solve this problem when I leave the data out of the cols part because I have the label type as text? ({ goInitView : function(component, event, helper, recordToDisplay, ...
0
votes
0answers
12 views

dynamic JSON values [duplicate]

Any idea how to parse a dynamic JSON. The metadata in json can or cannot contain value. Value are dynamic. Metadata name are be different with value. Some it can have 2 or 1 metadata. So to create ...
5
votes
1answer
280 views

What is recommended way to unit test JSON Parser based on JSON.deserializeUntyped calls?

We are doing a lot of JSON data parsing in our solution by own JSON parser implementation. I wonder how can I write unit tests for JSON parser. Is it good approach to load JSON data from static ...
3
votes
2answers
24 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
2answers
25 views

Changing a list of sObjects into a JSON

Having trouble with my apex code. I have a list of objects from my trigger that I want to transform into a JSON format - can't seem to work out a way to get it going and the code I have so far is ...
0
votes
2answers
68 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 ...