longValue

fun JsonElement.longValue(vararg keys: String): Long

Navigates to the nested element at keys and returns its Long value. Extension function on JsonElement.


val JsonElement.longValue: Long

Returns the Long value of this JsonElement's primitive content, for values such as IDs and millisecond timestamps that exceed Int. Extension property on JsonElement.

The content, quoted or not, must be a JSON integer (-?(0|[1-9][0-9]*)), as for intValue.

Throws

if this element is JSON null, not a primitive, or not an integer in range