I used JSONGenerator to generate a customized JSON String. I know I can return sObject or String using Salesforce REST. But now I am sure I do not want to return sObject because I want the customized format. But I also do not want to return a String because client app is expecting a strict JSON object. How can I solve this?
Tell me more
×
Salesforce Stack Exchange is a question and answer site for
Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
|
If you have a JSON object as a String, you can return it by assigning it to the
Result:
Alterntively, you can define an inline Apex class with the format you require. For example:
yields
|
||||
|
|