New answers tagged

0

Yes, you can do it in one line: String assessmentFormString = JSON.serialize(form); This assumes your form is the variable name of your apex class instance. This JSON output can be directly sent to your API in the body of your request.


1

The outer [] means this is an array. You need two iterators: <aura:iteration items="{!v.mainRecords}" var="record"> <aura:iteration items="{!record.rows}" var="mainRec"> <div class="slds-col slds-size_1-of-6"> {!mainRec} </div> </aura:iteration> </aura:...


2

for question #3: For an easy way to get basic JSON to an APEX parser you can save some time and start with http://json2apex.herokuapp.com/ and that should get you a working starting point and you can then modify it for your specific needs.


1

I solved my own problem. The variable being read in the SOQL was being pre-escaped because it as a rich text field. I used unescapeHtml4() String function on it and now it renders properly.


-1

req.setBody('{"accountid":"0015g000004mi4BAAQ","name":"'+myname+'","website":"'+web+'"}'); works perfectly


3

No, there's nothing wrong with your code. The parentheses are simply how System.debug() prints a List value. Note that System.debug() is not a JSON serialization; it's an idiosyncratic logging representation that may not align with any other representation of the underlying data. Your data is being deserialized correctly. If you want a more standardized log ...


0

I think you made a pretty good first attempt. There's a few ways you can go about it. Personally, I like to use class deserialization due to its simplicity and type enforcement, unless there are things like reserved keywords to deal with. Here's my approach: JSON Class public without sharing class ResultsJSON { public List<ResultItem> results {get;} ...


2

The deserialization needs to know what concrete type to use and that is signalled by an attributes field: "records":[{"attributes": {"type": "fund__c"}, "Name":"Fund1", ... so if the system that generates the JSON can provide that, get it added. Or if the records are always fund__c: public List<...


1

Understanding Relationship Query Limitations In each specified relationship, only one level of parent-to-child relationship can be specified in a query. For example, if the FROM clause specifies Account, the SELECT clause can specify only the Contact or other objects at that level. It could not specify a child object of Contact. About generating Json from ...


2

Instead of deserializing the JSON on apex class, pass the JSON to javascript controller and parse the json into javascript object. Also javascript will process the json much faster than apex and you will have control on json/javscript object to play with on javascript. import retrievePhone from "@salesforce/apex/ApexClassName.retrievePhone"; ...


Top 50 recent answers are included