optBoolean

fun optBoolean(jsonObject: JSONObject, @Size(min = 1) fieldName: String): Boolean

Calls through to JSONObject.optBoolean only in the case that the key exists. This returns null if the key is not in the object.

Return

the value stored in the requested field, or false if the key is not present

Parameters

jsonObject

the input object

fieldName

the required field name