JSONArray

class JSONArray : JSONData, Iterable<JSONData>

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

Author

Todd L Smith

Parameters

array

The array of JSONDatas. This must not be modified by the caller afterward; this call transfers ownership of the reference.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun forEach(p0: Consumer<in JSONData>)
Link copied to clipboard
operator fun get(index: Int): JSONData

Get a JSONData at the requested subscript.

Link copied to clipboard
fun getArray(index: Int): JSONArray

Get a JSONArray at the requested subscript.

Link copied to clipboard
fun getBoolean(index: Int): Boolean

Get a Boolean at the requested subscript.

Link copied to clipboard
fun getNumber(index: Int): JSONNumber

Get a JSONNumber at the requested subscript.

Link copied to clipboard
fun getObject(index: Int): JSONObject

Get a JSONObject at the requested subscript.

Link copied to clipboard
fun getString(index: Int): String

Get a String at the requested subscript.

Link copied to clipboard
open operator override fun iterator(): ListIterator<JSONData>
Link copied to clipboard
fun size(): Int

Answer the length of the receiver.

Link copied to clipboard
open fun spliterator(): Spliterator<JSONData>
Link copied to clipboard
open override fun writeTo(writer: JSONWriter)

Emit a JSON representation of the receiver onto the specified writer.

Properties

Link copied to clipboard
open val bigDecimal: BigDecimal

If this is a JSONNumber, extract its value as a BigDecimal, otherwise throw a ClassCastException.

Link copied to clipboard
val bigDecimals: List<BigDecimal>

Extract a List of BigDecimal, throwing a ClassCastException if any elements are non-numeric.

Link copied to clipboard
open val bigInteger: BigInteger

If this is a JSONNumber, extract its value as a BigInteger, otherwise throw a ClassCastException. If the value has a non-zero fractional part, throw an ArithmeticException.

Link copied to clipboard
val bigIntegers: List<BigInteger>

Extract a List of BigInteger, throwing a ClassCastException if any elements are non-numeric, or an ArithmeticException if any elements are non-integral. The first element to fail determines which exception is thrown.

Link copied to clipboard
open val boolean: Boolean

Extract a Boolean, or throw a ClassCastException if the value is not a boolean.

Link copied to clipboard
val booleans: List<Boolean>

Extract a List of Booleans, throwing a ClassCastException if any element is not a boolean.

Link copied to clipboard
open val double: Double

If this is a JSONNumber, extract its value as a Double, otherwise throw a ClassCastException.

Link copied to clipboard
val doubles: List<Double>

Extract a List of Doubles, throwing a ClassCastException if any elements are non-numeric.

Link copied to clipboard
open val float: Float

If this is a JSONNumber, extract its value as a Float, otherwise throw a ClassCastException.

Link copied to clipboard
val floats: List<Float>

Extract a List of Floats, throwing a ClassCastException if any elements are non-numeric.

Link copied to clipboard
open val int: Int

If this is a JSONNumber, extract its value as an Int, otherwise throw a ClassCastException. If the value has a non-zero fractional part or is out of range, throw an ArithmeticException.

Link copied to clipboard
val ints: List<Int>

Extract a List of Ints, throwing a ClassCastException if any elements are non-numeric, or an ArithmeticException if any elements are non-integral or overflow an Int. The first element to fail determines which exception is thrown.

Link copied to clipboard
open override val isArray: Boolean

Is the receiver a JSON?

Link copied to clipboard
open val isBoolean: Boolean

Is the receiver a JSON boolean?

Link copied to clipboard
open val isNull: Boolean

Is the receiver a JSON null?

Link copied to clipboard
open val isNumber: Boolean

Is the receiver a JSON?

Link copied to clipboard
open val isObject: Boolean

Is the receiver a JSON?

Link copied to clipboard
open val isString: Boolean

Is the receiver a JSON string?

Link copied to clipboard
open val long: Long

If this is a JSONNumber, extract its value as a Long, otherwise throw a ClassCastException. If the value has a non-zero fractional part or is out of range, throw an ArithmeticException.

Link copied to clipboard
val longs: List<Long>

Extract a List of Longs, throwing a ClassCastException if any elements are non-numeric, or an ArithmeticException if any elements are non-integral or overflow a Long. The first element to fail determines which exception is thrown.

Link copied to clipboard
open val string: String

Extract a String, or throw a ClassCastException if the value is not a string.

Link copied to clipboard
val strings: List<String>

Extract a List of Strings, throwing a ClassCastException if any element is not a string.