How to determine when json is null? for example: [{"username": null}, {"username": "null"}]
The first case is an unused username, and the second is named "null". But if you try to restore them, both values will result in the string "null"
JSONObject json = new JSONObject("{\"hello\":null}"); json.put("bye", JSONObject.NULL); Log.e("LOG", json.toString()); Log.e("LOG", "hello="+json.getString("hello") + " is null? " + (json.getString("hello") == null)); Log.e("LOG", "bye="+json.getString("bye") + " is null? " + (json.getString("bye") == null));
Magazine exit
{"hello":"null","bye":null} hello=null is null? false bye=null is null? false
java json android
Addev May 14 '12 at 18:12 2012-05-14 18:12
source share