JsonValue

A JsonValue is a representation of any value that can be described using JSON. It can contain one of the following: a JsonMap, a JsonList, a Number, a Boolean, String, or it can contain null.

JsonValues can be created from Java Objects by calling wrap or from a JSON String by calling parseString. The JsonValue toString returns the JSON String representation of the object.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val integer: Int?
Link copied to clipboard

Checks if the value is a Boolean.

Link copied to clipboard

Checks if the value is a Double.

Link copied to clipboard

Checks if the value is a Float.

Link copied to clipboard

Checks if the value is an Integer.

Link copied to clipboard

Checks if the value is a JsonList.

Link copied to clipboard

Checks if the value is a JsonMap.

Link copied to clipboard

Checks if the value is a Long.

Link copied to clipboard

If the contained value is null.

Link copied to clipboard

Checks if the value is a Number.

Link copied to clipboard

Checks if the value is a String.

Link copied to clipboard
Link copied to clipboard
val map: JsonMap?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Gets the raw value of the JsonValue. Will be either a String, Boolean, Long, Double, Integer, JsonMap, JsonList, or null.

Functions

Link copied to clipboard

Gets the contained value coerced into a String.

Link copied to clipboard
open override fun describeContents(): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getBoolean(defaultValue: Boolean): Boolean

Gets the contained values as a boolean.

Link copied to clipboard
fun getDouble(defaultValue: Double): Double

Gets the contained values as an double.

Link copied to clipboard
fun getFloat(defaultValue: Float): Float

Gets the contained values as a float.

Link copied to clipboard
fun getInt(defaultValue: Int): Int

Gets the contained values as an int.

Link copied to clipboard
fun getLong(defaultValue: Long): Long

Gets the contained values as an long.

Link copied to clipboard
fun getString(defaultValue: String): String

Gets the contained values as a String.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Gets the contained values as a JsonList.

Link copied to clipboard

Gets the contained values as a JsonMap.

Link copied to clipboard

Returns the String value or an empty String.

Link copied to clipboard

Requires the value to be a JsonList or a JsonException will be thrown.

Link copied to clipboard

Requires the value to be a JsonMap or a JsonException will be thrown.

Link copied to clipboard

Requires the value to be a String or a JsonException will be thrown.

Link copied to clipboard
open override fun toJsonValue(): JsonValue

Returns the objects represented as a JsonValue.

Link copied to clipboard
open override fun toString(): String

Returns the JsonValue as a JSON encoded String.

fun toString(sortKeys: Boolean): String

Returns the JsonValue as a JSON encoded String with sorted keys.

Link copied to clipboard
fun write(stringer: JSONStringer, sortKeys: Boolean)

Helper method that is used to write the value as a JSON String.

Link copied to clipboard
open override fun writeToParcel(dest: Parcel, flags: Int)