How to test if JSON object is empty in Java

前端 未结 15 2419

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

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

What I\'m trying

15条回答
  •  醉话见心
    2020-12-14 00:33

    I would do the following to check for an empty object

    obj.similar(new JSONObject())
    

提交回复
热议问题