optCurrency

@Size(value = 3)
fun optCurrency(jsonObject: JSONObject, @Size(min = 1) fieldName: String): String?

Calls through to JSONObject.optString while safely converting the raw string "null" and the empty string to null, along with any value that isn't a three-character string.

Return

a three-letter currency code if one is found, or null

Parameters

jsonObject

the object from which to retrieve the currency code

fieldName

the name of the field in which the currency code is stored