optInteger

fun optInteger(jsonObject: JSONObject, @Size(min = 1) fieldName: String): Int?

Calls through to JSONObject.optInt 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 null if the key is not present

Parameters

jsonObject

the input object

fieldName

the required field name