Package org.availlang.json

Types

Link copied to clipboard
class JSONArray : JSONData, Iterable<JSONData>

A JSONArray is produced by a JSONReader when an array is read. Each element is a JSONData.

Link copied to clipboard
sealed class JSONData : JSONFriendly

JSONData is the superclass of JSONValue, JSONNumber, JSONArray, and JSONObject. A readsJSONReader.read a single JSONData.

Link copied to clipboard
abstract class JSONException : RuntimeException

A JSONReader throws a JSONException if anything goes wrong during the reading of a JSON document.

Link copied to clipboard
interface JSONFriendly

A class can implement JSONFriendly to enable JSON serialization of its instances.

Link copied to clipboard
class JSONIOException : JSONException

A JSONIOException is an unchecked that wraps an IOException.

Link copied to clipboard
object JSONNull : JSONData

The sole JSON null value.

Link copied to clipboard
class JSONNumber(val bigDecimal: BigDecimal) : JSONData

A JSONNumber is a JSON number. It provides convenience methods for extracting numeric values in different formats.

Link copied to clipboard
class JSONObject : JSONData, Iterable<Map.Entry<String, JSONData>>

A JSONObject is produced by a JSONReader when an object is read. Each key of the object is a String and each value is a JSONData.

Link copied to clipboard
class JSONReader constructor(reader: Reader) : Closeable

A JSONReader produces JSON-friendly value given a valid JSON document.

Link copied to clipboard
abstract class JSONStateException : IllegalStateException

An IllegalStateException thrown by a JSONWriter if an attempt is made to write content that doesn't align with the currently expected JSONWriter.JSONState.

Link copied to clipboard
class JSONValue : JSONData

A JSONValue is an arbitrary JSON value. JSONValues are produced by a JSONReader.

Link copied to clipboard
open class JSONWriter(writer: Writer = StringWriter(), prettyPrint: Boolean = false) : AutoCloseable

A stateful JSON writer that produces ASCII-only documents that adhere strictly to ECMA 404: "The JSON Data Interchange Format".

Link copied to clipboard
class MalformedJSONException : JSONException

A JSONException thrown by JSONReader if an invalid construct is encountered during the parsing of a JSON document.

Functions

Link copied to clipboard
fun booleanJSONArray(iterator: Iterator<Boolean>): JSONArray

Wrap an Iterator of Boolean wrapped in a JSONArray.

Link copied to clipboard
fun doubleJSONArray(iterator: Iterator<Double>): JSONArray

Wrap an Iterator of Double wrapped in a JSONArray.

Link copied to clipboard
fun floatJSONArray(iterator: Iterator<Float>): JSONArray

Wrap an Iterator of Float wrapped in a JSONArray.

Link copied to clipboard
fun intJSONArray(iterator: Iterator<Int>): JSONArray

Wrap an Iterator of Int wrapped in a JSONArray.

Link copied to clipboard
fun jsonArray(reader: Reader, arrayAction: JSONArray.() -> Unit = {}): JSONArray
fun jsonArray(raw: String, arrayAction: JSONArray.() -> Unit = {}): JSONArray

Answer a JSONArray that has had the provided arrayAction applied to it.

Link copied to clipboard
fun jsonData(reader: Reader, dataAction: JSONData.() -> Unit = {}): JSONData

Answer a JSONData that has had the provided dataAction applied to it.

Link copied to clipboard
fun jsonObject(reader: Reader, objectAction: JSONObject.() -> Unit = {}): JSONObject
fun jsonObject(raw: String, objectAction: JSONObject.() -> Unit = {}): JSONObject

Answer a JSONObject that has had the provided objectAction applied to it.

Link copied to clipboard
fun jsonPrettyPrintWriter(writerAction: JSONWriter.() -> Unit = {}): JSONWriter

Answer a pretty-print JSONWriter that has had the provided writerAction applied to it.

Link copied to clipboard
fun jsonReader(reader: Reader, readerAction: JSONReader.() -> Unit = {}): JSONReader
fun jsonReader(raw: String, readerAction: JSONReader.() -> Unit = {}): JSONReader

Answer a JSONReader that has had the provided readerAction applied to it.

Link copied to clipboard
fun jsonWriter(writerAction: JSONWriter.() -> Unit = {}): JSONWriter

Answer a JSONWriter that has had the provided writerAction applied to it.

Link copied to clipboard
fun longJSONArray(iterator: Iterator<Long>): JSONArray

Wrap an Iterator of Long wrapped in a JSONArray.

Link copied to clipboard
fun stringJSONArray(iterator: Iterator<String>): JSONArray

Wrap an Iterator of String wrapped in a JSONArray.

Properties

Link copied to clipboard
val Float.json: JSONData

Float wrapped in a JSONData.

val Float?.json: JSONData

Nullable Float wrapped in a JSONData.

val Double.json: JSONData

Double wrapped in a JSONData.

val Double?.json: JSONData

Nullable Double wrapped in a JSONData.

val Int.json: JSONData

Int wrapped in a JSONData.

val Int?.json: JSONData

Nullable Int wrapped in a JSONData.

val Long.json: JSONData

Long wrapped in a JSONData.

val Long?.json: JSONData

Nullable Long wrapped in a JSONData.

val String.json: JSONData

String wrapped in a JSONData.

val Boolean.json: JSONData

Boolean wrapped in a JSONData.

val Boolean?.json: JSONData

Nullable Boolean wrapped in a JSONData.

Link copied to clipboard
val String?.jsonNullable: JSONData

Nullable String wrapped in a JSONData.