function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
venugopalg sfdcvenugopalg 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? 
firdoss mohd 1firdoss mohd 1
Hi Venugopalg,
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