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
Shreya SalesforceShreya Salesforce 

How to remove json object with null value from json array in Apex.

"customer" : [ {
    "Type" : "Prospect",
    "SFDCAccountId" : "0016F000034Noh8QAC",
    "Phone" : "855245286896",
    "Name" : "acc3",
    "Email" : "test@test.com"
  }, null ],
karthikeyan perumalkarthikeyan perumal
Hello, 

You have to serialize JSON Response. use below code, 
 
string jsonCusString = JSON.serialize( customer, true );
System.debug('Serialized list of customers into JSON format: ' + jsonCusString );

Hope this will help you. 

Thanks
karthik