You need to sign in to do that
Don't have an account?
venugopalg sfdc
apex json serialize() method adds 'attributes' property
I have created a Case object like below
Case testCase = new Case(
Subject = 'Test record',
Status = 'New',
Origin = 'Phone',
Priority = 'Medium');
I am getting below output when I serialize it using JSON.serialize(testCase).
{"attributes":{"type":"Case"},"Subject":"Test record","Status":"New","Origin":"Phone","Priority":"Medium"}
Any idea why did "attributes" property add to the JSON and how to avoid it or is there any predefined method to stop coming in JSON?
Case testCase = new Case(
Subject = 'Test record',
Status = 'New',
Origin = 'Phone',
Priority = 'Medium');
I am getting below output when I serialize it using JSON.serialize(testCase).
{"attributes":{"type":"Case"},"Subject":"Test record","Status":"New","Origin":"Phone","Priority":"Medium"}
Any idea why did "attributes" property add to the JSON and how to avoid it or is there any predefined method to stop coming in JSON?
It looks like our team of experts can help you resolve this ticket. We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!
https://jbshelpdesk.secure.force.com
Thanks,
Jarvis SFDC team