How to compare null value from the JsonObject in java

前端 未结 7 889
灰色年华
灰色年华 2020-12-30 23:15

stackoverflow member i need some help from you.

I am having a JsonObject given below

{
\"Id\": null,
\"Name\": \"New Task\",
\"StartDate\": \"2010-03         


        
相关标签:
7条回答
  • 2020-12-30 23:36

    For anyone using org.json.JSONObject in 2020, if you have {"key":null}

    Check the value of the key by JSONObject.NULL

    JSONObject json = new JSONObject("{"key":null}");
    Object value = json.get("key");
    if (value == JSONObject.NULL){
      ...
    }
    
    0 讨论(0)
提交回复
热议问题