opt

open fun opt(obj: JSONObject, key: String): Any

Return null if object doesn't have key or if obj has null for key JSONObject.opt(key) return the JSONObject.NULL if object has null for key and null if object doesn't have key


open fun opt(arr: JSONArray, index: Int): Any

Return null if arr doesn't have value at index or the value is null JSONArray.opt(index) return the JSONObject.NULL if array has null at index and null if array doesn't have value at index