Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How does JSON serialize apex work?

Asked by Bruce Benedict Feb 10, 2023 1.3K views 1 answer
Share

About this question

 I have an object that's pretty extensive (lots of properties and child relationships). I'd like to serialize it. So I am doing the following:

Proposal__c proposal = (Proposal__c) getRecord();
String s = JSON.serialize(proposal);
The output:
{"attributes":      
    {
       "type":"WWK_Proposal__c",
       "url":"/services/data/v29.0/sobjects/WWK_Proposal__c/a0cM0000001BfBLIA0"
    },
    "Id":"a0cM0000001BfBLIA0"
}

And that is all. How can I get the entire object serialized, perhaps even including its child relationships?

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.