Put a key/value pair in the JSONObject, but only if the key and the value are both non-null. @param key A key string. @param value An object which is the value. It should be of one of these types: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSON
(String key, Object value)
| 1447 | * @throws JSONException If the value is a non-finite number. |
| 1448 | */ |
| 1449 | public JSONObject putOpt(String key, Object value) throws JSONException { |
| 1450 | if (key != null && value != null) { |
| 1451 | this.put(key, value); |
| 1452 | } |
| 1453 | return this; |
| 1454 | } |
| 1455 | |
| 1456 | /** |
| 1457 | * Remove a name and its value, if present. |