How to test if JSON object is empty in Java

前端 未结 15 2411

The JSON object I\'m receiving looks like this:

[{\"foo1\":\"bar1\", \"foo2\":\"bar2\", \"problemkey\": \"problemvalue\"}]

What I\'m trying

15条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 00:13

    Use the following code:

    if(json.isNull()!= null){  //returns true only if json is not null
    
    }
    

提交回复
热议问题