How to compare null value from the JsonObject in java

前端 未结 7 951
灰色年华
灰色年华 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:25

    These two methods works

    if( jsonObject.get("parentId").equals(null) )

    if( jsonObject.isNull("parentId") )

    Because the JSONObject has its own Null class, so java primitive null is not same as Null() in JSONObject.

提交回复
热议问题