How can we define null as a data type in Android, how do we define nsNull in an iPhone

jsonObject.accumulate("status",null);

I want to pass a null value as a value in a json service call. I try "" , " " , NULL , nil , "null" but nothing helps

Does anyone have a solution for this?

+8
json android null types
source share
1 answer

Try using JSONObject.NULL instead of null if you are using org.json.

Link to the documentation .

change

I tried to create a json object with a null value, something like this.

  JSONObject jsonObject = new JSONObject(); jsonObject.put("Test", JSONObject.NULL); 

and the output created by printing was {"Test": null}

So, I think it will do the magic for you. :)

+6
source share

All Articles