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

Linear Supertypes
Serializable, Product, Equals, Json[JsArray], JsValue, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsArray
  2. Serializable
  3. Product
  4. Equals
  5. Json
  6. JsValue
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JsArray(seq: Seq[JsValue] = Vector.empty)

    seq

    immutable seq of JsValue

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def +(path: JsPath, value: JsValue): JsArray
    Definition Classes
    Json
    Annotations
    @inline()
  4. final def +!(path: JsPath, value: JsValue, padWith: JsValue = JsNull): JsArray
    Definition Classes
    Json
    Annotations
    @inline()
  5. def ++:(xs: IterableOnce[JsValue]): JsArray
    Annotations
    @inline()
  6. def +:(value: JsValue): JsArray
    Annotations
    @inline()
  7. final def -(path: JsPath): JsArray
    Definition Classes
    Json
    Annotations
    @inline()
  8. final def --(xs: IterableOnce[JsPath]): JsArray
    Definition Classes
    Json
    Annotations
    @inline()
  9. def :+(value: JsValue): JsArray
    Annotations
    @inline()
  10. def :++(xs: IterableOnce[JsValue]): JsArray
    Annotations
    @inline()
  11. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def appended(value: JsValue): JsArray
  13. def appendedAll(xs: IterableOnce[JsValue]): JsArray
  14. def apply(i: Int): JsValue
  15. final def apply(path: JsPath): JsValue
    Definition Classes
    Json
  16. def array(path: JsPath): Option[JsArray]
    Definition Classes
    Json
  17. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  18. def asJsArray: JsArray

    returns this value as a JsArray if it's an array, throwing an UserError otherwise.

    returns this value as a JsArray if it's an array, 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

    isArr

    can help to that purpose.

    isArr }}}

    returns

    this value as a JsArray

    Definition Classes
    JsArrayJsValue
  19. def asJsBigDec: JsBigDec

    returns this value as a JsBigDec if it's a decimal number, throwing an UserError otherwise.

    returns this value as a JsBigDec if it's a decimal number, 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

    isDecimal

    can help to that purpose.

    isDecimal }}}

    returns

    this value as a JsBigDec

    Definition Classes
    JsonJsValue
  20. def asJsBigInt: JsBigInt

    returns this value as a JsBigInt if it's an integral number, throwing an UserError otherwise.

    returns this value as a JsBigInt if it's an integral number, 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

    isIntegral

    can help to that purpose.

    isIntegral }}}

    returns

    this value as a JsBigInt

    Definition Classes
    JsonJsValue
  21. def asJsBool: JsBool

    returns this value as a JsBool if it's a boolean, throwing an UserError otherwise.

    returns this value as a JsBool if it's a boolean, 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

    isBool

    can help to that purpose.

    isBool }}}

    returns

    this value as a JsBool

    Definition Classes
    JsonJsValue
  22. 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

    Definition Classes
    JsonJsValue
  23. 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

    Definition Classes
    JsonJsValue
  24. def asJsLong: JsLong

    returns this value as a JsLong if it is a JsLong or a JsInt, throwing an UserError otherwise.

    returns this value as a JsLong if it is a JsLong or 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 condition

    isInt || isLong

    can help to that purpose.

    isInt || isLong }}}

    returns

    this value as a JsLong

    Definition Classes
    JsonJsValue
  25. def asJsNull: JsNull.type

    returns this value as a JsNull if it's null, throwing an UserError otherwise.

    returns this value as a JsNull if it's null, 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

    isNull

    can help to that purpose.

    isNull }}}

    returns

    this value as a JsNull

    Definition Classes
    JsonJsValue
  26. def asJsNumber: JsNumber

    returns this value as a JsNumber if it's a number, throwing an UserError otherwise.

    returns this value as a JsNumber if it's a number, throwing an UserError otherwise. It's the responsibility of the caller to make sure the invocation to this function doesn't fail. The guard condition

    isNumber

    can help to that purpose.

    isNumber }}}

    returns

    this value as a JsNumber

    Definition Classes
    JsonJsValue
  27. def asJsObj: JsObj

    returns this value as a JsObj if it's an object, throwing an UserError otherwise.

    returns this value as a JsObj if it's an object, 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

    isObj

    can help to that purpose.

    isObj }}}

    returns

    this value as a JsObj

    Definition Classes
    JsArrayJsValue
  28. def asJsStr: JsStr

    returns this value as a JsStr if it's a string, throwing an UserError otherwise.

    returns this value as a JsStr if it's a string, 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

    isStr

    can help to that purpose.

    isStr }}}

    returns

    this value as a JsStr

    Definition Classes
    JsonJsValue
  29. def asJson: Json[_]

    returns this value as a Json if it's an object or an array, throwing an UserError otherwise.

    returns this value as a Json if it's an object or an array, 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

    isJson

    can help to that purpose.

    isJson }}}

    returns

    this value as a Json

    Definition Classes
    JsArrayJsValue
  30. def bigDecimal(path: JsPath): Option[BigDecimal]
    Definition Classes
    Json
  31. def bigInt(path: JsPath): Option[BigInt]
    Definition Classes
    Json
  32. def bool(path: JsPath): Option[Boolean]
    Definition Classes
    Json
  33. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  34. def containsPath(path: JsPath): Boolean
    Definition Classes
    Json
  35. def count(p: ((JsPath, JsValue)) => Boolean = (_: (JsPath, JsValue)) => true): Int
    Definition Classes
    Json
  36. def countRec(p: ((JsPath, JsValue)) => Boolean = (_: (JsPath, JsValue)) => true): Int
    Definition Classes
    Json
  37. def double(path: JsPath): Option[Double]
    Definition Classes
    Json
  38. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. def equals(that: Any): Boolean
    Definition Classes
    JsArray → Equals → AnyRef → Any
  40. def exists(p: ((JsPath, JsValue)) => Boolean): Boolean
    Definition Classes
    Json
  41. def filter(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  42. def filterJsObj(p: (JsPath, JsObj) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  43. def filterJsObjRec(p: (JsPath, JsObj) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  44. def filterKey(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  45. def filterKeyRec(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  46. def filterRec(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    JsArrayJson
  47. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  48. 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
    JsArrayJson
    Note

    the difference with flattenRec

  49. 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

    Definition Classes
    JsArrayJson
    Note

    the difference with flatten

  50. def get(path: JsPath): Option[JsValue]
    Definition Classes
    Json
  51. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  52. def head: JsValue
  53. def id: Int

    Every implementation of this trait has an unique identifier.

    Every implementation of this trait has an unique identifier.

    returns

    unique identifier of the type

    Definition Classes
    JsArrayJsValue
  54. def init: JsArray
    Definition Classes
    JsArrayJson
  55. def inserted(path: JsPath, value: JsValue, padWith: JsValue = JsNull): JsArray
    Definition Classes
    JsArrayJson
  56. def int(path: JsPath): Option[Int]
    Definition Classes
    Json
  57. def isArr: Boolean

    returns true if this is an array

    returns true if this is an array

    Definition Classes
    JsArrayJsValue
  58. 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
  59. def isBigDec: Boolean

    returns true if this is a big decimal.

    returns true if this is a big decimal.

    returns

    true if this is a big decimal and false otherwise. If this is a double, it returns false.

    Definition Classes
    JsonJsValue
  60. def isBigInt: Boolean

    returns true if this is a big integer.

    returns true if this is a big integer.

    returns

    true if this is a big integer and false otherwise. If this is either an integer or a long, it returns false.

    Definition Classes
    JsonJsValue
  61. def isBool: Boolean

    returns true if this is a boolean

    returns true if this is a boolean

    Definition Classes
    JsonJsValue
  62. 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
  63. def isDecimal: Boolean

    returns true if this type is a decimal number

    returns true if this type is a decimal number

    returns

    isDouble || isBigDec
    Definition Classes
    JsValue
  64. def isDouble: Boolean

    returns true if this is a double

    returns true if this is a double

    Definition Classes
    JsonJsValue
  65. 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
  66. def isEmpty: Boolean
    Definition Classes
    JsArrayJson
  67. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  68. def isInt: Boolean

    returns true if this is an integer (32 bit precision number)

    returns true if this is an integer (32 bit precision number)

    Definition Classes
    JsonJsValue
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. def isLong: Boolean

    returns true if this is a long (62 bit precision number)

    returns true if this is a long (62 bit precision number)

    returns

    true if this is a long and false otherwise. If this is an integer, it returns false.

    Definition Classes
    JsonJsValue
  75. 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
  76. def isNotEmpty: Boolean
    Definition Classes
    Json
  77. 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
  78. def isNotNumber: Boolean

    returns true if this is not a number

    returns true if this is not a number

    Definition Classes
    JsValue
  79. def isNothing: Boolean

    returns true if this is JsNothing

    returns true if this is JsNothing

    returns

    true if this is JsNothing, false otherwise

    Definition Classes
    JsonJsValue
  80. def isNull: Boolean

    returns true if this is JsNull

    returns true if this is JsNull

    returns

    true if this is JsNull, false otherwise

    Definition Classes
    JsonJsValue
  81. def isNumber: Boolean

    returns true if this is a number

    returns true if this is a number

    Definition Classes
    JsonJsValue
  82. def isObj: Boolean

    returns true if this is an object

    returns true if this is an object

    Definition Classes
    JsArrayJsValue
  83. 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
  84. def isStr: Boolean

    returns true if this is a string

    returns true if this is a string

    Definition Classes
    JsonJsValue
  85. 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
  86. def last: JsValue
  87. def length(): Int
  88. def long(path: JsPath): Option[Long]
    Definition Classes
    Json
  89. def map[J <: JsValue](m: (JsPath, JsValue) => J, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    JsArrayJson
  90. def mapIfNotNull[T](default: () => T, map: (JsValue) => T): T

    if this is JsNull, it returns a value computed by the default supplier.

    if this is JsNull, it returns a value computed by the default supplier. Otherwise, it returns the result of applying the map function to this.

    T

    the type of the returned value

    default

    the supplier to compute the default value

    map

    the map function

    returns

    a value of type T

    Definition Classes
    JsValue
  91. def mapKey(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    JsArrayJson
  92. def mapKeyRec(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    JsArrayJson
  93. def mapRec[J <: JsValue](m: (JsPath, JsValue) => J, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    JsArrayJson
  94. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  95. final def nonEmpty: Boolean
    Definition Classes
    Json
  96. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  97. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  98. def obj(path: JsPath): Option[JsObj]
    Definition Classes
    Json
  99. def prepended(value: JsValue): JsArray
  100. def prependedAll(xs: IterableOnce[JsValue]): JsArray
  101. def productElementNames: Iterator[String]
    Definition Classes
    Product
  102. def reduce[V](p: (JsPath, JsValue) => Boolean = (_, _) => true, m: (JsPath, JsValue) => V, r: (V, V) => V): Option[V]
    Definition Classes
    JsArrayJson
  103. def reduceRec[V](p: (JsPath, JsValue) => Boolean = (_, _) => true, m: (JsPath, JsValue) => V, r: (V, V) => V): Option[V]
    Definition Classes
    JsArrayJson
  104. def removed(path: JsPath): JsArray
    Definition Classes
    JsArrayJson
  105. def removedAll(xs: IterableOnce[JsPath]): JsArray
    Definition Classes
    JsArrayJson
  106. def serialize: Array[Byte]
    Definition Classes
    Json
  107. def serialize(outputStream: OutputStream): () => Unit
    Definition Classes
    Json
  108. def size: Int
    Definition Classes
    JsArrayJson
  109. def string(path: JsPath): Option[String]
    Definition Classes
    Json
  110. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  111. def tail: JsArray
    Definition Classes
    JsArrayJson
  112. def toPrettyString: String
    Definition Classes
    Json
  113. def toString(): String

    string representation of this Json array.

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

    returns

    string representation of this Json array

    Definition Classes
    JsArrayJson → AnyRef → Any
  114. def updated(path: JsPath, value: JsValue): JsArray
    Definition Classes
    JsArrayJson
  115. def validate(spec: ArrayOfObjSpec): LazyList[(JsPath, Invalid)]
  116. def validate(spec: JsArraySpec): LazyList[(JsPath, Invalid)]
  117. def validate(predicate: JsArrayPredicate): Result
  118. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  119. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  120. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Json[JsArray]

Inherited from JsValue

Inherited from AnyRef

Inherited from Any

Ungrouped