JsonStructureFacade

grapple.json.JsonStructureFacade

Assumes either JSON object or JSON array.

Attributes

See also
Note

A structure facade is created by conversion only.

Graph
Supertypes
trait JsonArray
trait JsonObject
trait JsonValue
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def ++(other: JsonObject): JsonObject

Concatenates JSON object.

Concatenates JSON object.

Attributes

Returns

new JSON object

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(key: String): JsonValue

Gets value.

Gets value.

Value parameters

key

object key

Attributes

Throws
java.util.NoSuchElementException

if key does not exist

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 fields: Map[String, JsonValue]

Gets object fields.

Gets object fields.

Attributes

def get(key: String): Option[JsonValue]

Optionally gets value.

Optionally gets value.

Value parameters

key

object key

Attributes

Throws
java.util.NoSuchElementException

if key does not exist

def keys: Set[String]

Gets object keys.

Gets object keys.

Attributes

def removed(key: String): JsonObject

Removes field.

Removes field.

Value parameters

key

object key

Attributes

Returns

new JSON object

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 size: Int

Gets size.

Gets size.

Attributes

Unwraps underlying JSON structure.

Unwraps underlying JSON structure.

Attributes

def updated(key: String, value: JsonValue): JsonObject

Adds or updates field.

Adds or updates field.

Value parameters

key

object key

value

new value

Attributes

Returns

new JSON object

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

Inherited methods

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

Converts value.

Converts value.

Value parameters

input

converter

Attributes

Inherited from:
JsonValue
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

Inherited from:
JsonArray
def getArray(key: String): JsonArray

Gets value as JsonArray.

Gets value as JsonArray.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonArray

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getBigDecimal(key: String): BigDecimal

Gets value as BigDecimal.

Gets value as BigDecimal.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getBigInt(key: String): BigInt

Gets value as BigInt.

Gets value as BigInt.

Value parameters

key

object key

Attributes

Throws
java.lang.ArithmeticException

if not represented exactly

java.lang.ClassCastException

if not JsonNumber

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getBoolean(key: String): Boolean

Gets value as Boolean.

Gets value as Boolean.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonBoolean

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getDouble(key: String): Double

Gets value as Double.

Gets value as Double.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getFloat(key: String): Float

Gets value as Float.

Gets value as Float.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonNumber

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getInt(key: String): Int

Gets value as Int.

Gets value as Int.

Value parameters

key

object key

Attributes

Throws
java.lang.ArithmeticException

if not represented exactly

java.lang.ClassCastException

if not JsonNumber

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getLong(key: String): Long

Gets value as Long.

Gets value as Long.

Value parameters

key

object key

Attributes

Throws
java.lang.ArithmeticException

if not represented exactly

java.lang.ClassCastException

if not JsonNumber

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getObject(key: String): JsonObject

Gets value as JsonObject.

Gets value as JsonObject.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonObject

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
def getOrElse(key: String, default: => JsonValue): JsonValue

Gets value or returns default.

Gets value or returns default.

Value parameters

default

default value

key

object key

Attributes

Inherited from:
JsonObject
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

Inherited from:
JsonArray
def getString(key: String): String

Gets value as String.

Gets value as String.

Value parameters

key

object key

Attributes

Throws
java.lang.ClassCastException

if not JsonString

java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
def isEmpty: Boolean

Tests for empty.

Tests for empty.

Attributes

Inherited from:
JsonStructure
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

Inherited from:
JsonArray
def isNull(key: String): Boolean

Tests for null.

Tests for null.

Value parameters

key

object key

Attributes

Throws
java.util.NoSuchElementException

if key does not exist

Inherited from:
JsonObject
def nonEmpty: Boolean

Tests for non-empty.

Tests for non-empty.

Attributes

Inherited from:
JsonStructure
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

Inherited from:
JsonArray
def read[T](key: String)(using JsonInput[T]): T

Reads value.

Reads value.

Value parameters

key

object key

Attributes

Throws
java.lang.NullPointerException

if value is null

java.util.NoSuchElementException

if key does not exists

Inherited from:
JsonObject
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.

Inherited from:
JsonArray
def readOption[T](key: String)(using JsonInput[T]): Option[T]

Optionally reads value.

Optionally reads value.

Value parameters

key

object key

Attributes

Note

The value is not read if it is null.

Inherited from:
JsonObject
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 from:
JsonArray
def readOrElse[T](key: String, default: => T)(using JsonInput[T]): T

Reads value or returns default value.

Reads value or returns default value.

Value parameters

default

default value

key

object key

Attributes

Note

The value is not read if it is null.

Inherited from:
JsonObject

Concrete fields

lazy override val toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.