Package com.urbanairship.json

A convenient JSON framework built on top of org.json classes.

Types

JsonException
Link copied to clipboard
open class JsonException : Exception
Thrown when a JsonValue is unable to wrap an object or unable to parse a JSON encoded String.
JsonList
Link copied to clipboard
open class JsonList : Iterable<JsonValue> , JsonSerializable
An immutable list of JsonValues.
JsonMap
Link copied to clipboard
open class JsonMap : Iterable<Map.Entry<String, JsonValue>> , JsonSerializable
An immutable mapping of String keys to JsonValues.
JsonMatcher
Link copied to clipboard
open class JsonMatcher : JsonSerializable, Predicate<JsonSerializable>
Class representing the leaf node of a JsonPredicate that contains the relevant field matching info.
JsonPredicate
Link copied to clipboard
open class JsonPredicate : JsonSerializable, Predicate<JsonSerializable>
Class abstracting a JSON predicate.
JsonSerializable
Link copied to clipboard
interface JsonSerializable
Interface for classes whose instances can be written as a JsonValue.
JsonValue
Link copied to clipboard
open class JsonValue : Parcelable, JsonSerializable
A JsonValue is a representation of any value that can be described using JSON.
ValueMatcher
Link copied to clipboard
abstract class ValueMatcher : JsonSerializable, Predicate<JsonSerializable>
Class representing the field matching type and values contained in a JsonMatcher.

Functions

jsonListOf
Link copied to clipboard
fun jsonListOf(vararg values: Any): JsonList
jsonMapOf
Link copied to clipboard
fun jsonMapOf(vararg fields: Pair<String, *>): JsonMap
optionalField
Link copied to clipboard
inline fun <T> JsonMap.optionalField(key: String): T?
Gets the field with the given key from the JsonMap, or null if not defined.
requireField
Link copied to clipboard
inline fun <T> JsonMap.requireField(key: String): T
Gets the field with the given key from the JsonMap, ensuring it is non-null.
toJsonList
Link copied to clipboard
fun <T : JsonSerializable> List<T>.toJsonList(): JsonList
toJsonMap
Link copied to clipboard
fun <T : JsonSerializable> Map<String, T?>.toJsonMap(): JsonMap
tryParse
Link copied to clipboard
inline fun <T, R : JsonSerializable> R.tryParse(logError: Boolean = false, parser: (R) -> T): T?