📌  相关文章
📜  json对象检查键是否存在java - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:27.458000             🧑  作者: Mango

代码示例1
// JSONObject class has a method named "has":
// http://developer.android.com/reference/org/json/JSONObject.html#has(java.lang.String)
// Returns true if this object has a mapping for name. The mapping may be NULL.
if (json.has("status")) {
   String status = json.getString("status"));
}

if (json.has("club")) {
   String club = json.getString("club"));
}