Packages

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:
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. def appended(value: JsValue): JsArray
  2. def appendedAll(xs: IterableOnce[JsValue]): JsArray
    Definition Classes
    AbstractJsArray
  3. 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
  4. def apply(i: Int): JsValue
    Definition Classes
    AbstractJsArray
  5. def concat(other: JsArray, ARRAY_AS: JsArray.TYPE.Value = JsArray.TYPE.LIST): JsArray
  6. 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
  7. 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
  8. def equals(that: Any): Boolean
    Definition Classes
    JsArray → Equals → AnyRef → Any
  9. 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
  10. def filter(p: (JsValue) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  11. def filterAll(p: (JsPrimitive) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  12. def filterAll(p: (JsPath, JsPrimitive) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  13. def filterAllJsObj(p: (JsObj) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  14. def filterAllJsObj(p: (JsPath, JsObj) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  15. def filterAllKeys(p: (String) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  16. def filterAllKeys(p: (JsPath, JsValue) => Boolean): JsArray
    Definition Classes
    AbstractJsArray
  17. def flatMap(f: (JsValue) => JsArray): JsArray
    Definition Classes
    AbstractJsArray
  18. def flatten: LazyList[(JsPath, JsValue)]

    returns

    a lazy list of pairs of path and value

    Definition Classes
    AbstractJsArray
  19. def head: JsValue
    Definition Classes
    AbstractJsArray
  20. def id: Int

    Every implementation of this trait has an unique identifier in order.

    Every implementation of this trait has an unique identifier in order.

    returns

    unique identifier of the type

    Definition Classes
    JsArrayJsValue
  21. def init: JsArray
    Definition Classes
    AbstractJsArray
  22. 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.

    path

    the path

    value

    the value

    returns

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

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

    Definition Classes
    JsValue
  24. def isArr: Boolean
    Definition Classes
    AbstractJsArray
  25. def isBigDec: Boolean

    returns true if this is a big decimal.

    returns true if this is a big decimal.

    Definition Classes
    JsonJsValue
  26. def isBigInt: Boolean

    returns true if this is a big integer.

    returns true if this is a big integer.

    Definition Classes
    JsonJsValue
  27. def isBool: Boolean

    returns true if this is a boolean

    returns true if this is a boolean

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

    Definition Classes
    JsValue
  29. 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
  30. def isDouble: Boolean

    returns true if this is a double

    returns true if this is a double

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

    Definition Classes
    JsValue
  32. def isEmpty: Boolean
    Definition Classes
    AbstractJsArray
  33. 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
  34. 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

    Definition Classes
    JsValue
  35. 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

    Definition Classes
    JsValue
  36. 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
  37. 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
  38. def isJson(predicate: (Json[_]) => Boolean): Boolean

    returns true if this is a json that satisfies a predicate

    returns true if this is a json that satisfies a predicate

    predicate

    the predicate

    Definition Classes
    JsValue
  39. 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)

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

    Definition Classes
    JsValue
  41. def isNotEmpty: Boolean
    Definition Classes
    Json
  42. 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
  43. def isNotNull: Boolean

    returns true if this is not null

    returns true if this is not null

    Definition Classes
    JsValue
  44. def isNotNumber: Boolean

    returns true if this is not a number

    returns true if this is not a number

    Definition Classes
    JsValue
  45. def isNothing: Boolean

    returns true if this is JsNothing

    returns true if this is JsNothing

    Definition Classes
    JsonJsValue
  46. def isNull: Boolean

    returns true if this is JsNull

    returns true if this is JsNull

    Definition Classes
    JsonJsValue
  47. def isNumber: Boolean

    returns true if this is a number

    returns true if this is a number

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

    Definition Classes
    JsValue
  49. def isObj: Boolean
    Definition Classes
    AbstractJsArray
  50. def isPrimitive: Boolean

    returns true is this is a primitive type

    returns true is this is a primitive type

    Definition Classes
    JsonJsValue
  51. def isStr: Boolean

    returns true if this is a string

    returns true if this is a string

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

    Definition Classes
    JsValue
  53. def iterator: Iterator[JsValue]
    Definition Classes
    AbstractJsArray
  54. def knownSize: Int
    Definition Classes
    IterableOnce
  55. def last: JsValue
    Definition Classes
    AbstractJsArray
  56. def length(): Int
    Definition Classes
    AbstractJsArray
  57. def map(m: (JsValue) => JsValue): JsArray
    Definition Classes
    AbstractJsArray
  58. def mapAll(m: (JsPrimitive) => JsValue): JsArray
    Definition Classes
    AbstractJsArray
  59. def mapAll(m: (JsPath, JsPrimitive) => JsValue, p: (JsPath, JsPrimitive) => Boolean = (_, _) => true): JsArray
    Definition Classes
    AbstractJsArray
  60. def mapAllKeys(m: (String) => String): JsArray
    Definition Classes
    AbstractJsArray
  61. def mapAllKeys(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean = (_, _) => true): JsArray
    Definition Classes
    AbstractJsArray
  62. 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
  63. def prepended(value: JsValue): JsArray
  64. def prependedAll(xs: IterableOnce[JsValue]): JsArray
    Definition Classes
    AbstractJsArray
  65. def productElementNames: Iterator[String]
    Definition Classes
    Product
  66. def reduceAll[V](p: (JsPath, JsPrimitive) => Boolean = (_, _) => true, m: (JsPath, JsPrimitive) => V, r: (V, V) => V): Option[V]
    Definition Classes
    AbstractJsArray
  67. 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
  68. 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
  69. 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
  70. 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
  71. def size: Int
    Definition Classes
    AbstractJsArray
  72. def stepper[S <: Stepper[_]](implicit shape: StepperShape[JsValue, S]): S
    Definition Classes
    IterableOnce
  73. def tail: JsArray
    Definition Classes
    AbstractJsArray
  74. 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.

    Definition Classes
    JsArrayJsValue
  75. def toJsBigDec: 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.

    Definition Classes
    JsonJsValue
  76. def toJsBigInt: 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.

    Definition Classes
    JsonJsValue
  77. def toJsBool: 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.

    Definition Classes
    JsonJsValue
  78. def toJsDouble: 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.

    Definition Classes
    JsonJsValue
  79. def toJsInt: 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 condition isInt can help to that purpose.

    Definition Classes
    JsonJsValue
  80. def toJsLong: 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.

    Definition Classes
    JsonJsValue
  81. def toJsNull: 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.

    Definition Classes
    JsonJsValue
  82. def toJsNumber: 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.

    Definition Classes
    JsonJsValue
  83. def toJsObj: JsObj
    Definition Classes
    AbstractJsArray
  84. def toJsPrimitive: JsPrimitive
    Definition Classes
    JsonJsValue
  85. def toJsStr: 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.

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

    Definition Classes
    JsArrayJsValue
  87. 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
  88. 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
  89. def validate(spec: ArrayOfObjSpec): LazyList[(JsPath, Invalid)]
  90. def validate(spec: JsArraySpec): LazyList[(JsPath, Invalid)]
  91. def validate(predicate: JsArrayPredicate): Result