Find your content:

Search form

You are here

Native JSON parser issue

 
Share

It seems that json.serialize method converts null to String 'null'

System.debug(String.isEmpty(null));
Contact con = null;
String jsonCon = JSON.serialize(con);
System.debug(jsonCon);
System.debug(String.isEmpty(jsonCon));

Results in debug:

15:21:35.039 (39195000)|USER_DEBUG|[1]|DEBUG|true
15:21:35.039 (39503000)|USER_DEBUG|[6]|DEBUG|null
15:21:35.039 (39551000)|USER_DEBUG|[7]|DEBUG|false

Attribution to: Vlad

Possible Suggestion/Solution #1

As per the json spec, null is represented by the keyword null, so this seems right.


Attribution to: superfell
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5185

My Block Status

My Block Content