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 callingparseString. The JsonValue toString returns the JSON String representation of the object.

Properties

Link copied to clipboard
A null representation of the JsonValue.
Link copied to clipboard
val value: Any

Inherited properties

Link copied to clipboard

Functions

Link copied to clipboard
Gets the contained value coerced into a String.
Link copied to clipboard
open fun describeContents(): Int
Link copied to clipboard
open fun equals(@Nullable object: Any): Boolean
Link copied to clipboard
open fun getBoolean(defaultValue: Boolean): Boolean
Gets the contained values as a boolean.
Link copied to clipboard
open fun getDouble(defaultValue: Double): Double
Gets the contained values as an double.
Link copied to clipboard
open fun getFloat(defaultValue: Float): Float
Gets the contained values as a float.
Link copied to clipboard
open fun getInt(defaultValue: Int): Int
Gets the contained values as an int.
Link copied to clipboard
Gets the contained values as an Integer.
Link copied to clipboard
Gets the contained value as a JsonList.
Link copied to clipboard
open fun getLong(defaultValue: Long): Long
Gets the contained values as an long.
Link copied to clipboard
open fun getMap(): JsonMap
Gets the contained values as a JsonMap.
Link copied to clipboard
Gets the contained values as a Number.
Link copied to clipboard
Gets the contained value as a String.
open fun getString(@NonNull defaultValue: String): String
Gets the contained values as a String.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun isBoolean(): Boolean
Checks if the value is a Boolean.
Link copied to clipboard
open fun isDouble(): Boolean
Checks if the value is a Double.
Link copied to clipboard
open fun isFloat(): Boolean
Checks if the value is a Float.
Link copied to clipboard
open fun isInteger(): Boolean
Checks if the value is an Integer.
Link copied to clipboard
open fun isJsonList(): Boolean
Checks if the value is a JsonList.
Link copied to clipboard
open fun isJsonMap(): Boolean
Checks if the value is a JsonMap.
Link copied to clipboard
open fun isLong(): Boolean
Checks if the value is a Long.
Link copied to clipboard
open fun isNull(): Boolean
If the contained value is null.
Link copied to clipboard
open fun isNumber(): Boolean
Checks if the value is a Number.
Link copied to clipboard
open fun isString(): Boolean
Checks if the value is a String.
Link copied to clipboard
Gets the contained values as a JsonList.
Link copied to clipboard
open fun optMap(): JsonMap
Gets the contained values as a JsonMap.
Link copied to clipboard
Returns the String value or an empty String.
Link copied to clipboard
open fun parseString(@Nullable jsonString: String): JsonValue
Parse a JSON encoded 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
Returns the objects represented as a JsonValue.
Link copied to clipboard
open fun toString(): String
Returns the JsonValue as a JSON encoded String.
open fun toString(sortKeys: Boolean): String
Returns the JsonValue as a JSON encoded String with sorted keys.
Link copied to clipboard
open fun wrap(value: Boolean): JsonValue
Wraps a boolean as a JsonValue.
open fun wrap(value: Char): JsonValue
Wraps a char as a JsonValue.
Wraps a JsonSerializable object as a JsonValue.
open fun wrap(value: Double): JsonValue
Wraps a double as a JsonValue.
open fun wrap(value: Int): JsonValue
Wraps an int as a JsonValue.
open fun wrap(@Nullable object: Any): JsonValue
open fun wrap(@Nullable object: Any, @NonNull defaultValue: JsonValue): JsonValue
Wraps any valid object into a JsonValue.
open fun wrap(@Nullable value: String): JsonValue
Wraps a String as a JsonValue.
open fun wrap(value: Long): JsonValue
Wraps a long as a JsonValue.
Link copied to clipboard
open fun wrapOpt(@Nullable object: Any): JsonValue
Wraps any valid object into a JsonValue.
Link copied to clipboard
open fun writeToParcel(@NonNull dest: Parcel, flags: Int)