api / tv.twelvetone.json / JsonValue / asFloat

asFloat

open fun asFloat(): Float

Returns this JSON value as a float value, assuming that this value represents a JSON number. If this is not the case, an exception is thrown.

If the JSON number is out of the Float range, Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY is returned.

Exceptions

UnsupportedOperationException - if this value is not a JSON number

Return
this value as float