putIfNotEmpty

fun JSONObject.putIfNotEmpty(name: String, jsonObject: JSONObject?)

Maps name to jsonObject, clobbering any existing name/value mapping with the same name. If the JSONObject is empty, any existing mapping for name is removed.


fun JSONObject.putIfNotEmpty(name: String, jsonArray: JSONArray?)

Maps name to jsonArray, clobbering any existing name/value mapping with the same name. If the JSONArray is empty, any existing mapping for name is removed.


fun JSONObject.putIfNotEmpty(name: String, jsonable: JSONable?)

Maps name to jsonable after converting it to a JSONObject, clobbering any existing name/value mapping with the same name. If the JSONObject argument is empty, any existing mapping for name is removed.