final case class JsArray(seq: Seq[JsValue] = Vector.empty) extends Json[JsArray] with Product with Serializable
represents an immutable Json array. There are several ways of creating a Json array, 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:
JsArray("a", true, JsObj("a" -> 1, "b" -> true, "c" -> "hi" ), JsArray(1,2) )
- seq
immutable seq of JsValue
- Alphabetic
- By Inheritance
- JsArray
- Serializable
- Product
- Equals
- Json
- JsValue
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def +(path: JsPath, value: JsValue): JsArray
- Definition Classes
- Json
- Annotations
- @inline()
- final def +!(path: JsPath, value: JsValue, padWith: JsValue = JsNull): JsArray
- Definition Classes
- Json
- Annotations
- @inline()
- def ++:(xs: IterableOnce[JsValue]): JsArray
- Annotations
- @inline()
- def +:(value: JsValue): JsArray
- Annotations
- @inline()
- final def -(path: JsPath): JsArray
- Definition Classes
- Json
- Annotations
- @inline()
- final def --(xs: IterableOnce[JsPath]): JsArray
- Definition Classes
- Json
- Annotations
- @inline()
- def :+(value: JsValue): JsArray
- Annotations
- @inline()
- def :++(xs: IterableOnce[JsValue]): JsArray
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def appended(value: JsValue): JsArray
- def appendedAll(xs: IterableOnce[JsValue]): JsArray
- def apply(i: Int): JsValue
- final def apply(path: JsPath): JsValue
- Definition Classes
- Json
- def array(path: JsPath): Option[JsArray]
- Definition Classes
- Json
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJsArray: JsArray
returns this value as a JsArray if it's an array, throwing an UserError otherwise.
- def asJsBigDec: JsBigDec
returns this value as a JsBigDec if it's a decimal number, throwing an UserError otherwise.
- def asJsBigInt: JsBigInt
returns this value as a JsBigInt if it's an integral number, throwing an UserError otherwise.
- def asJsBool: JsBool
returns this value as a JsBool if it's a boolean, throwing an UserError otherwise.
- def asJsDouble: JsDouble
returns this value as a JsDouble if it is a JsLong or a JsInt or a JsDouble, throwing an UserError otherwise.
returns this value as a JsDouble if it is a JsLong or a JsInt or a JsDouble, throwing an UserError otherwise. It's the responsibility of the caller to make sure the call to this function doesn't fail. The guard condition
isInt || isLong || isDouble
can help to that purpose.
isInt || isLong || isDouble }}}
- returns
this value as a JsDouble
- def asJsInt: JsInt
returns this value as a JsInt, throwing an UserError otherwise.
returns this value as a JsInt, throwing an UserError otherwise. It's the responsibility of the caller to make sure the call to this function doesn't fail. The guard It's the responsibility of the caller to make sure the call to this function doesn't fail. The guard condition
isInt
can help to that purpose.
isInt }}}
- returns
this value as a JsInt
- def asJsLong: JsLong
returns this value as a JsLong if it is a JsLong or a JsInt, throwing an UserError otherwise.
- def asJsNull: JsNull.type
returns this value as a JsNull if it's null, throwing an UserError otherwise.
- def asJsNumber: JsNumber
returns this value as a JsNumber if it's a number, throwing an UserError otherwise.
- def asJsObj: JsObj
returns this value as a JsObj if it's an object, throwing an UserError otherwise.
- def asJsStr: JsStr
returns this value as a JsStr if it's a string, throwing an UserError otherwise.
- def asJson: Json[_]
returns this value as a Json if it's an object or an array, throwing an UserError otherwise.
- def bigDecimal(path: JsPath): Option[BigDecimal]
- Definition Classes
- Json
- def bigInt(path: JsPath): Option[BigInt]
- Definition Classes
- Json
- def bool(path: JsPath): Option[Boolean]
- Definition Classes
- Json
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def containsPath(path: JsPath): Boolean
- Definition Classes
- Json
- def count(p: ((JsPath, JsValue)) => Boolean = (_: (JsPath, JsValue)) => true): Int
- Definition Classes
- Json
- def countRec(p: ((JsPath, JsValue)) => Boolean = (_: (JsPath, JsValue)) => true): Int
- Definition Classes
- Json
- def double(path: JsPath): Option[Double]
- Definition Classes
- Json
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(that: Any): Boolean
- Definition Classes
- JsArray → Equals → AnyRef → Any
- def exists(p: ((JsPath, JsValue)) => Boolean): Boolean
- Definition Classes
- Json
- def filter(p: (JsPath, JsValue) => Boolean): JsArray
- def filterJsObj(p: (JsPath, JsObj) => Boolean): JsArray
- def filterJsObjRec(p: (JsPath, JsObj) => Boolean): JsArray
- def filterKey(p: (JsPath, JsValue) => Boolean): JsArray
- def filterKeyRec(p: (JsPath, JsValue) => Boolean): JsArray
- def filterRec(p: (JsPath, JsValue) => Boolean): JsArray
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def flatten: LazyList[(JsPath, JsValue)]
returns a LazyList of pairs of (JsPath,JsValue) of the first level of this Json array:
returns a LazyList of pairs of (JsPath,JsValue) of the first level of this Json array:
val array = JsArray(1, "hi", JsArray(1,2), JsObj("e" -> 1, "f" -> true ) ) val pairs = array.toLazyList pairs.foreach { println } //prints out the following: (0, 1) (1, "hi") (2, [1,2]) (3, {"e":1,"f":true})
- returns
a lazy list of pairs of path and value
- Definition Classes
- JsArray → Json
- Note
the difference with flattenRec
- def flattenRec: LazyList[(JsPath, JsValue)]
returns a LazyList of pairs of (JsPath,JsValue) of the first level of this Json array:
returns a LazyList of pairs of (JsPath,JsValue) of the first level of this Json array:
val array = JsArray(1, "hi", JsArray(1,2), JsObj("e" -> 1, "f" -> true ) ) val pairs = array.toLazyListRec pairs.foreach { println } //prints out the following: (0, 1) (1, "hi") (2 / 0, 1) (2 / 1, 2) (3 / e, 1) (3 / f, true)
- returns
a lazy list of pairs of path and value
- def get(path: JsPath): Option[JsValue]
- Definition Classes
- Json
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def head: JsValue
- def id: Int
Every implementation of this trait has an unique identifier.
- def init: JsArray
- def inserted(path: JsPath, value: JsValue, padWith: JsValue = JsNull): JsArray
- def int(path: JsPath): Option[Int]
- Definition Classes
- Json
- def isArr: Boolean
returns true if this is an array
- def isArr(predicate: (JsArray) => Boolean): Boolean
returns true if this is an array that satisfies a predicate
returns true if this is an array that satisfies a predicate
- predicate
the predicate
- Definition Classes
- JsValue
- def isBigDec: Boolean
returns true if this is a big decimal.
- def isBigInt: Boolean
returns true if this is a big integer.
- def isBool: Boolean
returns true if this is a boolean
- def isDecimal(predicate: (BigDecimal) => Boolean): Boolean
returns true if this is a big decimal that satisfies a predicate
returns true if this is a big decimal that satisfies a predicate
- predicate
the predicate
- returns
true if this is a big decimal that satisfies the predicate. If this is a double, it returns false
- Definition Classes
- JsValue
- def isDecimal: Boolean
returns true if this type is a decimal number
- def isDouble: Boolean
returns true if this is a double
- def isDouble(predicate: (Double) => Boolean): Boolean
returns true if this is a double that satisfies a predicate
returns true if this is a double that satisfies a predicate
- predicate
the predicate
- returns
true if this is a double that satisfies the predicate
- Definition Classes
- JsValue
- def isEmpty: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isInt: Boolean
returns true if this is an integer (32 bit precision number)
- def isInt(predicate: (Int) => Boolean): Boolean
returns true if this is an integer that satisfies a predicate
returns true if this is an integer that satisfies a predicate
- predicate
the predicate
- Definition Classes
- JsValue
- def isIntegral(predicate: (BigInt) => Boolean): Boolean
returns true if this is a big integer that satisfies a predicate
returns true if this is a big integer that satisfies a predicate
- predicate
the predicate
- returns
true if this is a big integer that satisfies the predicate. If this is either an integer or a long, it returns false.
- Definition Classes
- JsValue
- def isIntegral: Boolean
returns true if this type is an integral number
returns true if this type is an integral number
- returns
isInt || isLong || isBigInt
- Definition Classes
- JsValue
- def isJson(predicate: (Json[_]) => Boolean): Boolean
returns true if this is a json that satisfy a predicate
returns true if this is a json that satisfy a predicate
- predicate
the predicate
- Definition Classes
- JsValue
- def isJson: Boolean
returns true is this type is an array or an object
returns true is this type is an array or an object
- Definition Classes
- JsValue
- def isLong: Boolean
returns true if this is a long (62 bit precision number)
- def isLong(predicate: (Long) => Boolean): Boolean
returns true if this is a long that satisfies a predicate
returns true if this is a long that satisfies a predicate
- predicate
the predicate
- returns
true if this is a long that satisfies the predicate and false otherwise. If this is an integer, it returns false.
- Definition Classes
- JsValue
- def isNotEmpty: Boolean
- Definition Classes
- Json
- def isNotJson: Boolean
returns true if this is neither an object nor an array
returns true if this is neither an object nor an array
- Definition Classes
- JsValue
- def isNotNumber: Boolean
returns true if this is not a number
returns true if this is not a number
- Definition Classes
- JsValue
- def isNothing: Boolean
returns true if this is JsNothing
- def isNull: Boolean
returns true if this is JsNull
- def isNumber: Boolean
returns true if this is a number
- def isObj: Boolean
returns true if this is an object
- def isObj(predicate: (JsObj) => Boolean): Boolean
returns true if this is an object that satisfies a predicate
returns true if this is an object that satisfies a predicate
- predicate
the predicate
- Definition Classes
- JsValue
- def isStr: Boolean
returns true if this is a string
- def isStr(predicate: (String) => Boolean): Boolean
returns true if this is a string that satisfies a predicate
returns true if this is a string that satisfies a predicate
- predicate
the predicate
- Definition Classes
- JsValue
- def last: JsValue
- def length(): Int
- def long(path: JsPath): Option[Long]
- Definition Classes
- Json
- def map[J <: JsValue](m: (JsPath, JsValue) => J, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
- def mapIfNotNull[T](default: () => T, map: (JsValue) => T): T
if this is JsNull, it returns a value computed by the default supplier.
- def mapKey(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
- def mapKeyRec(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
- def mapRec[J <: JsValue](m: (JsPath, JsValue) => J, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def nonEmpty: Boolean
- Definition Classes
- Json
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def obj(path: JsPath): Option[JsObj]
- Definition Classes
- Json
- def prepended(value: JsValue): JsArray
- def prependedAll(xs: IterableOnce[JsValue]): JsArray
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def reduce[V](p: (JsPath, JsValue) => Boolean = (_, _) => true, m: (JsPath, JsValue) => V, r: (V, V) => V): Option[V]
- def reduceRec[V](p: (JsPath, JsValue) => Boolean = (_, _) => true, m: (JsPath, JsValue) => V, r: (V, V) => V): Option[V]
- def removed(path: JsPath): JsArray
- def removedAll(xs: IterableOnce[JsPath]): JsArray
- def serialize: Array[Byte]
- Definition Classes
- Json
- def serialize(outputStream: OutputStream): () => Unit
- Definition Classes
- Json
- def size: Int
- def string(path: JsPath): Option[String]
- Definition Classes
- Json
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def tail: JsArray
- def toPrettyString: String
- Definition Classes
- Json
- def toString(): String
string representation of this Json array.
- def updated(path: JsPath, value: JsValue): JsArray
- def validate(spec: ArrayOfObjSpec): LazyList[(JsPath, Invalid)]
- def validate(spec: JsArraySpec): LazyList[(JsPath, Invalid)]
- def validate(predicate: JsArrayPredicate): Result
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()