Better way to determine if value exists in JSON feed

后端 未结 1 1576
無奈伤痛
無奈伤痛 2020-12-29 01:21

I\'m using the org.json.JSONObject (and parser) in an Android app to parse a JSON feed. Which is the best way to determine if a property exists or not in one of

相关标签:
1条回答
  • 2020-12-29 01:55

    You might use the JSONObject function has:

    if(myJSONObject.has("UnpublishDate")) {
        //it has it, do appropriate processing
    }
    
    0 讨论(0)
提交回复
热议问题