intOrNull

Returns null if provided Json is JsonNull or interprets given Json as JsonNumber and returns its value as Int.

Throws

if JSON structure does not match expected type


fun Json.intOrNull(key: String): Int?

Interprets given Json as JsonObject. Returns null if given key is not exists or value of given key is null. Otherwise, interprets value of given key as JsonNumber and returns its value as Int.

Throws

if JSON structure does not match expected type