JsonArray

grapple.json.JsonArray
See theJsonArray companion object
trait JsonArray extends JsonStructure

Represents JSON array.

Attributes

See also
Companion
object
Graph
Supertypes
trait JsonValue
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def ++(suffix: JsonArray): JsonArray

Concatenates JSON array.

Concatenates JSON array.

Attributes

Returns

new JSON array

def +:(value: JsonValue): JsonArray

Prepends value.

Prepends value.

Attributes

Returns

new JSON array

def :+(value: JsonValue): JsonArray

Appends value.

Appends value.

Attributes

Returns

new JSON array

def apply(index: Int): JsonValue

Gets value.

Gets value.

Value parameters

index

array index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

def removed(index: Int): JsonArray

Removes value at given index.

Removes value at given index.

Value parameters

index

array index

Attributes

Returns

new JSON array

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

Note

Subsequent values to index are shifted left.

def updated(index: Int, value: JsonValue): JsonArray

Updates value at given index.

Updates value at given index.

Value parameters

index

array index

value

JSON value

Attributes

Returns

new JSON array

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

def values: Seq[JsonValue]

Gets array values.

Gets array values.

Attributes

Concrete methods

def getArray(index: Int): JsonArray

Gets value as JsonArray.

Gets value as JsonArray.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonArray

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getBigDecimal(index: Int): BigDecimal

Gets value as BigDecimal.

Gets value as BigDecimal.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getBigInt(index: Int): BigInt

Gets value as BigInt.

Gets value as BigInt.

Value parameters

index

array index

Attributes

Throws
java.lang.ArithmeticException

if value cannot be represented exactly

java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getBoolean(index: Int): Boolean

Gets value as Boolean.

Gets value as Boolean.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonBoolean

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getDouble(index: Int): Double

Gets value as Double.

Gets value as Double.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getFloat(index: Int): Float

Gets value as Float.

Gets value as Float.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getInt(index: Int): Int

Gets value as Int.

Gets value as Int.

Value parameters

index

array index

Attributes

Throws
java.lang.ArithmeticException

if not represented exactly

java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getLong(index: Int): Long

Gets value as Long.

Gets value as Long.

Value parameters

index

array index

Attributes

Throws
java.lang.ArithmeticException

if not represented exactly

java.lang.ClassCastException

if not JsonNumber

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getObject(index: Int): JsonObject

Gets value as JsonObject.

Gets value as JsonObject.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonObject

java.lang.IndexOutOfBoundsException

if index is out of bounds

def getString(index: Int): String

Gets value as String.

Gets value as String.

Value parameters

index

array index

Attributes

Throws
java.lang.ClassCastException

if not JsonString

java.lang.IndexOutOfBoundsException

if index is out of bounds

def isNull(index: Int): Boolean

Tests for null.

Tests for null.

Value parameters

index

array index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

def read[T](index: Int)(using JsonInput[T]): T

Reads value.

Reads value.

Value parameters

index

array index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

java.lang.NullPointerException

if value is null

def readOption[T](index: Int)(using JsonInput[T]): Option[T]

Optionally reads value.

Optionally reads value.

Value parameters

index

array index

Attributes

Throws
java.lang.IndexOutOfBoundsException

if index is out of bounds

Note

The value is not read if it is null.

def readOrElse[T](index: Int, default: => T)(using JsonInput[T]): T

Reads value or returns default value.

Reads value or returns default value.

Value parameters

default

default value

index

array index

Attributes

Note

The value is not read if it is null.

Inherited methods

final def as[T](using input: JsonInput[T]): T

Converts value.

Converts value.

Value parameters

input

converter

Attributes

Inherited from:
JsonValue
def isEmpty: Boolean

Tests for empty.

Tests for empty.

Attributes

Inherited from:
JsonStructure
def nonEmpty: Boolean

Tests for non-empty.

Tests for non-empty.

Attributes

Inherited from:
JsonStructure
def size: Int

Gets size.

Gets size.

Attributes

Inherited from:
JsonStructure