api / tv.twelvetone.json / JsonValue / asLong

asLong

open fun asLong(): Long

Returns this JSON value as a long value, assuming that this value represents a JSON number that can be interpreted as Java long. If this is not the case, an exception is thrown.

To be interpreted as Java long, the JSON number must neither contain an exponent nor a fraction part. Moreover, the number must be in the Long range.

Exceptions

UnsupportedOperationException - if this value is not a JSON number NumberFormatException - if this JSON number can not be interpreted as long value

Return
this value as long