final case class JsArray(seq: Seq[JsValue] = Vector.empty) extends AbstractJsArray with IterableOnce[JsValue] with 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, IterableOnce[JsValue], AbstractJsArray, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. JsArray
  2. Serializable
  3. Product
  4. Equals
  5. Json
  6. JsValue
  7. IterableOnce
  8. AbstractJsArray
  9. AnyRef
  10. 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 ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def appended(value: JsValue): JsArray
  5. def appendedAll(xs: IterableOnce[JsValue]): JsArray
    Definition Classes
    AbstractJsArray
  6. final def apply(path: JsPath): JsValue

    Returns the element located at a specified path.

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

    path

    the path

    returns

    the json value found at the path

    Definition Classes
    Json
  7. def apply(i: Int): JsValue
    Definition Classes
    AbstractJsArray
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. def containsPath(path: JsPath): Boolean

    Returns true if there is an element at the specified path

    Returns true if there is an element at the specified path

    path

    the path

    returns

    true if the path exists, false otherwise

    Definition Classes
    Json
  11. def count(p: ((JsPath, JsValue)) => Boolean = (_: (JsPath, JsValue)) => true): Int

    Returns the number of elements that satisfy the given predicate

    Returns the number of elements that satisfy the given predicate

    p

    the predicate to test each path/value pair

    returns

    number of elements that satisfy the predicate

    Definition Classes
    Json
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(that: Any): Boolean
    Definition Classes
    JsArray → Equals → AnyRef → Any
  14. def exists(p: ((JsPath, JsValue)) => Boolean): Boolean

    Tests whether a predicate holds for at least one element of this Json

    Tests whether a predicate holds for at least one element of this Json

    p

    the predicate to test each path/value pair

    returns

    true if the given predicate is satisfied by at least one path/value pair, otherwise false

    Definition Classes
    Json
  15. def filter(p: (JsPrimitive) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  16. def filter(p: (JsPath, JsPrimitive) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  17. def filterJsObj(p: (JsObj) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  18. def filterJsObj(p: (JsPath, JsObj) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  19. def filterKeys(p: (String) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  20. def filterKeys(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  21. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  22. def flatMap(f: (JsValue) => JsArray): JsArray
    Definition Classes
    AbstractJsArray
  23. 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.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
    AbstractJsArray
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def head: JsValue
    Definition Classes
    AbstractJsArray
  26. 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
  27. def init: JsArray
    Definition Classes
    AbstractJsArray
  28. def inserted(path: JsPath, value: JsValue, padWith: JsValue = JsNull): JsArray

    Creates a new Json obtained by inserting a given path/value pair into this Json.

    Creates a new Json obtained by inserting a given path/value pair into this Json. The given element is always inserted at the given path, even if it requires to create new Json or padding arrays.

    JsObj.empty.inserted(path,value)(path) == value //always true
    path

    the path

    value

    the value

    returns

    A new Json with the new path/value mapping added to this Json.

    Definition Classes
    JsArrayJson
    Note

    inserted function unless updated, always inserts the given path/value pair

  29. 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
  30. def isArr: Boolean
    Definition Classes
    AbstractJsArray
  31. def isBigDec: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  32. def isBigInt: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  33. def isBool: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  34. 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
  35. 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
  36. def isDouble: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  37. 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
  38. def isEmpty: Boolean
    Definition Classes
    AbstractJsArray
  39. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  40. def isInt: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. def isLong: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  47. 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
  48. def isNotEmpty: Boolean
    Definition Classes
    Json
  49. 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
  50. def isNotNull: Boolean

    returns true if this is not null

    returns true if this is not null

    returns

    true if this is not null, false otherwise

    Definition Classes
    JsValue
  51. def isNotNumber: Boolean

    returns true if this is not a number

    returns true if this is not a number

    Definition Classes
    JsValue
  52. def isNothing: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  53. def isNull: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  54. def isNumber: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  55. 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
  56. def isObj: Boolean
    Definition Classes
    AbstractJsArray
  57. def isStr: Boolean

    return false

    return false

    returns

    false

    Definition Classes
    JsonJsValue
  58. 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
  59. def iterator: Iterator[JsValue]
    Definition Classes
    AbstractJsArray
  60. def knownSize: Int
    Definition Classes
    IterableOnce
  61. def last: JsValue
    Definition Classes
    AbstractJsArray
  62. def length(): Int
    Definition Classes
    AbstractJsArray
  63. def map[J <: JsValue](m: (JsPrimitive) => J): JsArray
    Definition Classes
    AbstractJsArray
  64. def map[J <: JsValue](m: (JsPath, JsPrimitive) => J, p: (JsPath, JsPrimitive) => Boolean = (_, _) => true): JsArray
    Definition Classes
    AbstractJsArray
  65. def mapKeys(m: (String) => String): JsArray
    Definition Classes
    AbstractJsArray
  66. def mapKeys(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    AbstractJsArray
  67. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  68. 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

    Definition Classes
    Json
  69. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  70. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  71. def prepended(value: JsValue): JsArray
  72. def prependedAll(xs: IterableOnce[JsValue]): JsArray
    Definition Classes
    AbstractJsArray
  73. def productElementNames: Iterator[String]
    Definition Classes
    Product
  74. def reduce[V](p: (JsPath, JsPrimitive) => Boolean = (_, _) => true, m: (JsPath, JsPrimitive) => V, r: (V, V) => V): Option[V]
    Definition Classes
    AbstractJsArray
  75. def removed(path: JsPath): JsArray

    Removes a path from this Json

    Removes a path from this Json

    path

    the path to be removed

    returns

    If this Json does not contain a binding for path it is returned unchanged. Otherwise, returns a new Json without a binding for path

    Definition Classes
    JsArrayJson
  76. def removedAll(xs: IterableOnce[JsPath]): JsArray

    Creates a new Json from this Json by removing all paths of another collection

    Creates a new Json from this Json by removing all paths of another collection

    xs

    the collection containing the paths to remove

    returns

    a new Json with the given paths removed.

    Definition Classes
    JsArrayJson
  77. def serialize: Array[Byte]

    Serialize this Json into an array of bytes.

    Serialize this Json into an array of bytes. When possible, it's more efficient to work on byte level that with strings

    returns

    this Json serialized into an array of bytes

    Definition Classes
    Json
  78. 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

    outputStream

    the output stream

    returns

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

    Definition Classes
    Json
  79. def size: Int
    Definition Classes
    AbstractJsArray
  80. def stepper[S <: Stepper[_]](implicit shape: StepperShape[JsValue, S]): S
    Definition Classes
    IterableOnce
  81. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  82. def tail: JsArray
    Definition Classes
    AbstractJsArray
  83. def toJsArray: 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
  84. def toJsBigDec: JsBigDec

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsBigDec

    Definition Classes
    JsonJsValue
  85. def toJsBigInt: JsBigInt

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsBigInt

    Definition Classes
    JsonJsValue
  86. def toJsBool: JsBool

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsBool

    Definition Classes
    JsonJsValue
  87. def toJsDouble: JsDouble

    throws an UserError exception

    throws an UserError exception

    Definition Classes
    JsonJsValue
  88. def toJsInt: JsInt

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsInt

    Definition Classes
    JsonJsValue
  89. def toJsLong: JsLong

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsLong

    Definition Classes
    JsonJsValue
  90. def toJsNull: JsNull.type

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsNull

    Definition Classes
    JsonJsValue
  91. def toJsNumber: JsNumber

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsNumber

    Definition Classes
    JsonJsValue
  92. def toJsObj: JsObj
    Definition Classes
    AbstractJsArray
  93. def toJsStr: JsStr

    throws an UserError exception

    throws an UserError exception

    returns

    this value as a JsStr

    Definition Classes
    JsonJsValue
  94. def toJson: 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
  95. def toPrettyString: String

    Converts the string representation of this Json to a pretty print version

    Converts the string representation of this Json to a pretty print version

    returns

    pretty print version of the string representation of this Json

    Definition Classes
    Json
  96. 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
  97. def validate(spec: ArrayOfObjSpec): LazyList[(JsPath, Invalid)]
  98. def validate(spec: JsArraySpec): LazyList[(JsPath, Invalid)]
  99. def validate(predicate: JsArrayPredicate): Result
  100. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  101. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  102. 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 IterableOnce[JsValue]

Inherited from AbstractJsArray

Inherited from AnyRef

Inherited from Any

Ungrouped