JsObj

final case class JsObj(bindings: Map[String, JsValue]) extends IterableOnce[(String, JsValue)] with Json[JsObj]

represents an immutable Json object. There are several ways of creating a Json object, being the most common the following:

  • From a string, array of bytes or an input stream of bytes, using the parse functions of the companion object
  • From the apply function of the companion object.
Value parameters:
bindings

immutable map of JsValue

Companion:
object
trait Serializable
trait Product
trait Equals
trait Json[JsObj]
trait JsValue
trait IterableOnce[(String, JsValue)]
class Object
trait Matchable
class Any

Value members

Concrete methods

def concat(other: JsObj): JsObj
override def equals(that: Any): Boolean
Definition Classes
Equals -> Any
def removed(key: String): JsObj
override def removed(path: JsPath): JsObj
Definition Classes
def removedAll(keys: IterableOnce[String]): JsObj
override def serialize(config: WriterConfig): Array[Byte]
Definition Classes
override def serialize(outputStream: OutputStream, config: WriterConfig): () => Unit
Definition Classes
override def toPrettyString(config: WriterConfig): String
Definition Classes
override def toString: String

string representation of this Json array. It's a lazy json.value which is only computed once.

string representation of this Json array. It's a lazy json.value which is only computed once.

Returns:

string representation of this Json array

Definition Classes
Json -> Any
def updated(key: String, value: JsValue): JsObj
override def updated(path: JsPath, value: JsValue, padWith: JsValue): JsObj
Definition Classes

Inherited methods

@tailrec
final def apply(path: JsPath): JsValue

Returns the element located at a specified path. This function is total on its argument. If no element is found, JsNothing is returned

Returns the element located at a specified path. This function is total on its argument. If no element is found, JsNothing is returned

Value parameters:
path

the path

Returns:

the json value found at the path

Inherited from:
Json
def apply(key: String): JsValue

Retrieves the json.value which is associated with the given key. If there is no mapping from the given key to a json.value, JsNothing is returned.

Retrieves the json.value which is associated with the given key. If there is no mapping from the given key to a json.value, JsNothing is returned.

Value parameters:
key

the key

Returns:

the json.value associated with the given key

Inherited from:
AbstractJsObj (hidden)
def contains(key: String): Boolean

Tests whether this json object contains a binding for a key.

Tests whether this json object contains a binding for a key.

Value parameters:
key

the key

Returns:

true if there is a binding for key in this map, false otherwise.

Inherited from:
AbstractJsObj (hidden)
def filter(p: JsPrimitive => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def filter(p: (JsPath, JsPrimitive) => Boolean): JsObj

Selects all elements of this Json object which satisfy a predicate.

Selects all elements of this Json object which satisfy a predicate.

Returns:

a new Json object consisting of all elements of this Json object that satisfy the given predicate p. The order of the elements is preserved.

Inherited from:
AbstractJsObj (hidden)
def filterJsObj(p: JsObj => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def filterJsObj(p: (JsPath, JsObj) => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def filterKeys(p: String => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def filterKeys(p: (JsPath, JsValue) => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def flatten: LazyList[(JsPath, JsValue)]

Flatten this Json object into a LazyList of pairs of (JsPath,JsValue) traversing recursively every noe-empty Json found along the way.

Flatten this Json object into a LazyList of pairs of (JsPath,JsValue) traversing recursively every noe-empty Json found along the way.

Returns:

a LazyList of pairs of JsPath and JsValue

Inherited from:
AbstractJsObj (hidden)
def getArray(path: JsPath): JsArray | Null
Inherited from:
Json
def getArray(path: JsPath, default: => JsArray): JsArray
Inherited from:
Json
def getArray(key: String): JsArray | Null
Inherited from:
AbstractJsObj (hidden)
def getArray(key: String, default: => JsArray): JsArray
Inherited from:
AbstractJsObj (hidden)
def getBigDec(path: JsPath): BigDecimal | Null
Inherited from:
Json
def getBigDec(path: JsPath, default: => BigDecimal): BigDecimal
Inherited from:
Json
def getBigDec(key: String): BigDecimal | Null
Inherited from:
AbstractJsObj (hidden)
def getBigDec(key: String, default: => BigDecimal): BigDecimal
Inherited from:
AbstractJsObj (hidden)
def getBigInt(path: JsPath): BigInt | Null
Inherited from:
Json
def getBigInt(path: JsPath, default: => BigInt): BigInt
Inherited from:
Json
def getBigInt(key: String): BigInt | Null
Inherited from:
AbstractJsObj (hidden)
def getBigInt(key: String, default: => BigInt): BigInt
Inherited from:
AbstractJsObj (hidden)
def getBool(path: JsPath): Boolean | Null
Inherited from:
Json
def getBool(path: JsPath, default: => Boolean): Boolean
Inherited from:
Json
def getBool(key: String): Boolean | Null
Inherited from:
AbstractJsObj (hidden)
def getBool(key: String, default: => Boolean): Boolean
Inherited from:
AbstractJsObj (hidden)
def getDouble(path: JsPath): Double | Null
Inherited from:
Json
def getDouble(path: JsPath, default: => Double): Double
Inherited from:
Json
def getDouble(key: String): Double | Null
Inherited from:
AbstractJsObj (hidden)
def getDouble(key: String, default: => Double): Double
Inherited from:
AbstractJsObj (hidden)
def getInt(path: JsPath): Int | Null
Inherited from:
Json
def getInt(path: JsPath, default: => Int): Int
Inherited from:
Json
def getInt(key: String): Int | Null
Inherited from:
AbstractJsObj (hidden)
def getInt(key: String, default: => Int): Int
Inherited from:
AbstractJsObj (hidden)
def getLong(path: JsPath): Long | Null
Inherited from:
Json
def getLong(path: JsPath, default: => Long): Long
Inherited from:
Json
def getLong(key: String): Long | Null
Inherited from:
AbstractJsObj (hidden)
def getLong(key: String, default: => Long): Long
Inherited from:
AbstractJsObj (hidden)
def getObj(path: JsPath): JsObj | Null
Inherited from:
Json
def getObj(path: JsPath, default: => JsObj): JsObj
Inherited from:
Json
def getObj(key: String): JsObj | Null
Inherited from:
AbstractJsObj (hidden)
def getObj(key: String, default: => JsObj): JsObj
Inherited from:
AbstractJsObj (hidden)
def getStr(path: JsPath): String | Null
Inherited from:
Json
def getStr(path: JsPath, default: => String): String
Inherited from:
Json
def getStr(key: String): String | Null
Inherited from:
AbstractJsObj (hidden)
def getStr(key: String, default: => String): String
Inherited from:
AbstractJsObj (hidden)
def head: (String, JsValue)

Selects the next element of the iterator of this Json object, throwing a NoSuchElementException if the Json object is empty

Selects the next element of the iterator of this Json object, throwing a NoSuchElementException if the Json object is empty

Returns:

the next element of the iterator of this Json object.

Inherited from:
AbstractJsObj (hidden)
def headOption: Option[(String, JsValue)]

Optionally selects the next element of the iterator of this Json object.

Optionally selects the next element of the iterator of this Json object.

Returns:

the first element of this Json object if it is nonempty. None if it is empty.

Inherited from:
AbstractJsObj (hidden)
def init: JsObj
Inherited from:
AbstractJsObj (hidden)
def isEmpty: Boolean

Tests whether the Json object is empty.

Tests whether the Json object is empty.

Returns:

true if the Json object contains no elements, false otherwise.

Inherited from:
AbstractJsObj (hidden)
def iterator: Iterator[(String, JsValue)]

Returns an iterator of this Json object. Can be used only once

Returns an iterator of this Json object. Can be used only once

Returns:

an iterator

Inherited from:
AbstractJsObj (hidden)
def keySet: Set[String]

Collects all keys of this map in a set.

Collects all keys of this map in a set.

Returns:

a set containing all keys of this map.

Inherited from:
AbstractJsObj (hidden)
def keys: Iterable[String]

Collects all keys of this Json object in an iterable collection.

Collects all keys of this Json object in an iterable collection.

Returns:

the keys of this Json object as an iterable.

Inherited from:
AbstractJsObj (hidden)
def knownSize: Int
Inherited from:
IterableOnce
def last: (String, JsValue)

Selects the last element of the iterator of this Json object, throwing a NoSuchElementException if the Json object is empty

Selects the last element of the iterator of this Json object, throwing a NoSuchElementException if the Json object is empty

Returns:

the last element of the iterator of this Json object.

Inherited from:
AbstractJsObj (hidden)
def lastOption: Option[(String, JsValue)]

Optionally selects the last element of the iterator of this Json object.

Optionally selects the last element of the iterator of this Json object.

Returns:

the last element of the iterator of this Json object, None if it is empty.

Inherited from:
AbstractJsObj (hidden)
Inherited from:
AbstractJsObj (hidden)
def map(m: (JsPath, JsPrimitive) => JsValue, p: (JsPath, JsPrimitive) => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
def mapKeys(m: String => String): JsObj
Inherited from:
AbstractJsObj (hidden)
def mapKeys(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean): JsObj
Inherited from:
AbstractJsObj (hidden)
final def nonEmpty: Boolean

returns true if the Json is non empty

returns true if the Json is non empty

Returns:

true if non empty, false otherwise

Inherited from:
Json
def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product
def reduce[V](p: (JsPath, JsPrimitive) => Boolean, m: (JsPath, JsPrimitive) => V, r: (V, V) => V): Option[V]
Inherited from:
AbstractJsObj (hidden)
def serialize(outputStream: OutputStream): () => Unit

Returns a zero-argument function that when called, it serializes this Json into the given output stream, no returning anything

Returns a zero-argument function that when called, it serializes this Json into the given output stream, no returning anything

Value parameters:
outputStream

the output stream

Returns:

() => Unit function that serializes this Json into the given output stream

Inherited from:
Json
def size: Int

The size of this Json object. *

The size of this Json object. *

Returns:

the number of elements in this Json object.

Inherited from:
AbstractJsObj (hidden)
def stepper[S <: Stepper[_]](implicit shape: StepperShape[(String, JsValue), S]): S
Inherited from:
IterableOnce
def tail: JsObj
Inherited from:
AbstractJsObj (hidden)