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 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(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.