optLong

fun optLong(jsonObject: JSONObject, @Size(min = 1) fieldName: String): Long?

Calls through to JSONObject.optLong 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