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.

-2
votes
1answer
24 views

Parsing Nested JSON to Apex Object & Display in Lightning Component [on hold]

I need help parsing this sample JSON response to Apex object. The main issues I face are: I want to display the inner values on Lightning component. I want to access the fields using dot notation e.g....
0
votes
0answers
7 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
14 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 ...
-1
votes
0answers
19 views

JSON to PDF conversion

Is there any way to convert JSON response to PDF? If yes, please let me know. I got web service response as JSON, I would like to convert/export it as PDF
0
votes
1answer
27 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
31 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
20 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
14 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
28 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
68 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
12 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
187 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
92 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
23 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
46 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
26 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
172 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
20 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
22 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
65 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 ...
-3
votes
1answer
49 views

Issue executing references in separate JSON2Apex class

I'm running into obscure issues while executing my Apex code that calls references from a separate JSON2Apex class and I can't figure out where I went wrong. JSON2Apex class: public virtual class ...
-1
votes
1answer
42 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", "...
-2
votes
1answer
39 views

How do I go deeper into JSON? [closed]

I'm following along with the code in this example and I want to know how I would go a level deeper into JSON output to obtain the values for the keys that I need: Map<String, Object> npiResults ...
0
votes
1answer
52 views

Issue linking two classes together

I'm running into a problem with my JSON2Apex code where I'm unable to define objects of another class in the current class I'm working on and I'm not sure where I'm running afoul. I tried changing the ...
1
vote
1answer
48 views

Not sure what to do next with JSON2Apex generated output

I'm not sure what to do next with my JSON2Apex generated output since I only need to see the values for three JSON keys. My generated output is approximately 300 lines long and below is a snippet of ...
0
votes
1answer
62 views

Invalid conversion from runtime type String to Map<String,ANY> not working

I have a requirement to call a external service with post method. When i tested in anymonous block.It's working fine. But when i try to set up test classes i got this error. in line Map results ...
1
vote
1answer
37 views

JSON content display : Attempt to de-reference a null object

I am trying to display content from a JSON feed on my Salesforce page using APEX/visualforce page. From information gathered, I am able to get the details of the JSON on variable. But when running the ...
0
votes
1answer
49 views

Not sure why I can't deserialize an HTTP JSON object response

I'm trying to figure out what I'm doing wrong here. I'm trying to quickly deserialize HTTP JSON output into a string to search thru and pull specific keys to see if they meet a certain condition. My ...
-1
votes
1answer
30 views

How do you perform JSON parsing in Apex scripting? [duplicate]

I obtained some JSON output from a REST response and I want to parse that directly in my Apex script to either run if-tests or determine which JSON key contains information to run further actions. ...
-1
votes
1answer
29 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: { "...
0
votes
1answer
35 views

FATAL_ERROR System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set

I want to run a class where it calls the static resource and input the values in the object. I have a Static Resource name Interest_Tag MIME Type application/json in following JSON format [ { ...
2
votes
3answers
141 views

Getting JSON_PARSER_ERROR while parsing JSON

What am i doing wrong due to which i am getting JSON_PARSER_ERROR, I am using code below to parse json below : @RestResource(urlMapping='/Imbellus/CandidateScore') global with sharing class ...
2
votes
1answer
38 views

How to use upsert in REST callout JSON

"Upsert" just inserts new records from JSON, but not updates existing. It's my code: public class myClass { @future (callout = true) public static void getCallout(){ Http http = new Http(); ...
4
votes
1answer
31 views

JSON serialization across managed packages

We're having an ecosystem of managed packages where one is dependend on another and sometimes there is a need that one package (e.g. extension package) need to serialize some objects from another ...
0
votes
1answer
23 views

Retrieve information from other Org using REST Callout

I am new in salesforce and i have a REST request callout to retrieve the information from the other ORG. My problem is, I don't know if my code is correct since there is no error but in my VFPage, ...
4
votes
1answer
38 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
3answers
48 views

JSON.exceptions when inserting JSON objects inside a larger whole

I'm strongly considering going the JSON.serialize route suggested here, but before I do, I thought I'd throw this up here. (I prefer JSONGenerator, in theory, because I can specify the field names, ...
3
votes
1answer
28 views

HealthCloud HL7 REST API Specification

I'm working to implement HealthCloud with an external system. HealthCloud provides the services/apexrest/HealthCloudGA/HL7 REST endpoint to accept HL7 messages and parse them into the Electronic ...
0
votes
1answer
33 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:...
2
votes
2answers
63 views

How to control the property name of a serialised object using Apex

BACKGROUND I need to generate the below JSON data: JSON { "Type": "ACCPAYCREDIT", "Status": "AUTHORISED", "Contact": { "ContactID": "eaa28f49-6028-4b6e-bb12-d8f6278073fc" }, "Date": ...
3
votes
1answer
107 views

How to convert BadgerFish JSON to Apex class?

So I am working with the D&B Hoover Direct 2.0 API to try and integrate data from there to Salesforce. I am successfully getting a JSON response that looks as follows: { "FindCompanyResponse":...
0
votes
0answers
24 views

parsing json response in soql query to access the data of other object - getting null

I’m getting the values from the LiveMessage Session object (When it is an individual query) but when I’m querying it from the Case Object it is showing blank rows (& vice versa).
0
votes
1answer
22 views

Malformed JSON: Expected '[' at the beginning of List/Set\n\nClass.System.JSON.deserialize

Through the Http response I will get the output like below. [{"CourseType":"OnlineCourse","Id":"05f932c9-1059-4495-87d9-2e7a09bd3930","Name":"Fundamentals of Contact Lenses","Description":"This ...
0
votes
1answer
231 views

String replace double quotes & slash

I'm trying JSON Parser and in the JSON I've \" (for like <tag style=\"color: #fff;\"...) If I can replace \" with \\" the parser works fine (like in this - https://developer.salesforce.com/forums/?...
1
vote
1answer
44 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 ...
0
votes
1answer
55 views

UPSERT Partial JSON

I am trying to add a feature by which I can update all records from a JSON payload, but the insert should only occur for those which have "archived" value = False. below is a sample JSON. My batch ...
0
votes
2answers
100 views

Deserialize Json String into from Map<String,List<CustomWrapperClass>> in apex

I am currently working on a Lightning component where the data that I am passing from my apex controller ( in the doInit() ) is in the form of Map<String,List<CustomWrapper>>. When Some ...
0
votes
1answer
11 views

PATCH Service deserilizaition into JSON Object

I'm building a PATCH service where I'm trying to deserlize into a JSON payload that has different levels. { "ShippingAddress": { "Country": "United States", "PostalCode": "80202", ...