You need to sign in to do that
Don't have an account?
Priya Raj 22
serialize the results of a SOQL query into JSON
how to serialize the results of a SOQL query into JSON into a apex class.
SOQL query : SELECT Id, AccountId form Opportunity WHERE Id = :parentOppId
SOQL query : SELECT Id, AccountId form Opportunity WHERE Id = :parentOppId
Hi @Priya Raj 22,
Try this-
Let me know if this was helpful. If it does, please mark it as Best Answer to help others too.
Thanks,
Shubham Raj
Opportunity Opportunityobj = new Opportunity();
Opportunityobj = [SELECT Id, AccountId form Opportunity WHERE Id = :parentOppId];
String jsonString = JSON.serialize(Opportunityobj);
Try the above code snippet
If it helps Please Mark as the best answer
Thanks