JsonValue

sealed class JsonValue : JsonField<Nothing>

A class representing an arbitrary JSON value.

It is immutable and assignable to any JsonField, regardless of its expected type (i.e. its generic type argument).

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard
interface Visitor<out R>

An interface that defines how to map each variant state of a JsonValue to a value of type R.

Functions

Link copied to clipboard
fun <R> accept(visitor: JsonField.Visitor<Nothing, R>): R

Returns the result of calling the visitor method corresponding to this field's state.

fun <R> accept(visitor: JsonValue.Visitor<R>): R

Returns the result of calling the visitor method corresponding to this value's variant.

Link copied to clipboard

Returns this field's list value, or null if it doesn't contain a list.

Link copied to clipboard

Returns this field's boolean value, or null if it doesn't contain a boolean.

Link copied to clipboard

Returns this field's "known" value, meaning it matches the type the SDK expects, or null if this field contains an arbitrary JsonValue.

Link copied to clipboard

Returns this field's numerical value, or null if it doesn't contain a number.

Link copied to clipboard

Returns this field's map value, or null if it doesn't contain a map.

Link copied to clipboard

Returns this field's string value, or null if it doesn't contain a string.

Link copied to clipboard
Link copied to clipboard

Returns this field's arbitrary JsonValue, meaning it mismatches the type the SDK expects, or null if this field contains a "known" value.

Link copied to clipboard
inline fun <R : Any> convert(): R?
fun <R : Any> convert(type: TypeReference<R>): R?
fun <R : Any> convert(type: KClass<R>): R?
Link copied to clipboard

Returns whether this field is missing, which means it will be omitted from the serialized JSON entirely.

Link copied to clipboard

Whether this field is explicitly set to null.