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
Farhat MirzaFarhat Mirza 

JSON Seralize Spring 13 issues

JSON.Serialize method not returning null fields(Copied from stack exchange).

We are in big problem with this release.

 

 

 

I have been using JSON.Serialize method extensively in one of customer's project. Today salesforce has started rolling out Spring '13 release on sandboxes. My customer's sandbox( cs11) is not listed onhttps://trust.salesforce.com/trust/maintenance/ but still Spring '13 is available in this sandbox.

 

I have noticed a change that if I serialize a sObject, Json Serializer doesn't return fields with null value in json. Before Spring '13 release it was working fine.

If this was a needed change to reduce size of serialized json, Salesforce should have made this version specific change or a overloaded method to keep backward compatibility. It has broken 30%-40% of my code that I will need to rewrite.

 

Salesforce please undo this change.

Current output: [ { "attributes": { "type": "ABC_c", "url": "/services/data/v27.0/sobjects/ABC_c/xxxx" }, "Active__c": false, "Id": "XXXX", "Name": "ABC" }, ]

Old output: [ { "attributes": { "type": "ABC_c", "url": "/services/data/v27.0/sobjects/ABC_c/xxxx" }, "Active_c": false, "FirstName_c": null, "Id": "XXXX", "Name": "ABC" }, ]