Determine if the JSONObject contains a specific key.
Parameters:
key A key string.
Returns:
true if the key exists in the JSONObject.
public boolean has(String key) {
return this.map.containsKey(key);
}
public JSONObject() {
this.map = new HashMap<String, Object>();
}
It can be seen that the judgment is made by using the Map.containsKey(key) method.
It can be seen that the judgment is made by using the Map.containsKey(key) method.
Determine whether there is a certain field in the class
Query whether the object contains the key and return boolean, which is consistent with the usage of Map.containsKey(key)