sealed trait Json[T <: Json[T]] extends JsValue
- Alphabetic
- By Inheritance
- Json
- JsValue
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
- abstract def filter(p: (JsPrimitive) => Boolean): T
Selects all the values of this Json which satisfy a predicate and are not Jsons.
Selects all the values of this Json which satisfy a predicate and are not Jsons. When a Json is found, it is filtered recursively.
- p
the predicate uses to test elements. The predicate accepts the value of each element
- returns
a new Json consisting of all elements of this Json that satisfy the given predicate p.
- abstract def filter(p: (JsPath, JsPrimitive) => Boolean): T
Selects all the values of this Json which satisfy a predicate and are not Jsons.
Selects all the values of this Json which satisfy a predicate and are not Jsons. When a Json is found, it is filtered recursively.
- p
the predicate uses to test elements. The predicate accepts the path/value pair of each element
- returns
a new Json consisting of all elements of this Json that satisfy the given predicate p.
- abstract def filterJsObj(p: (JsObj) => Boolean): T
Removes all the Json object of this Json which dont' satisfy a predicate.
Removes all the Json object of this Json which dont' satisfy a predicate. When a Json is found, it is filtered recursively (if it passes the filter).
- p
the predicate uses to test the Json object.
- returns
a new Json consisting of all its elements except those Json object that dont satisfy the given predicate p.
- abstract def filterJsObj(p: (JsPath, JsObj) => Boolean): T
Removes all the Json object of this Json which dont' satisfy a predicate.
Removes all the Json object of this Json which dont' satisfy a predicate. When a Json is found, it is filtered recursively (if it passes the filter).
- p
the predicate uses to test the path/object pairs.
- returns
a new Json consisting of all its elements except those Json object that dont satisfy the given predicate p.
- abstract def filterKeys(p: (String) => Boolean): T
Removes all the keys of this Json which dont' satisfy a predicate.
Removes all the keys of this Json which dont' satisfy a predicate. When a Json is found, it is filtered recursively.
- p
the predicate uses to test the keys.
- returns
a new Json consisting of all array elements of this Json and those key/value pairs that satisfy the given predicate p.
- abstract def filterKeys(p: (JsPath, JsValue) => Boolean): T
Removes all the keys of this Json which dont' satisfy a predicate.
Removes all the keys of this Json which dont' satisfy a predicate. When a Json is found, it is filtered recursively.
- p
the predicate uses to test the path/value pairs.
- returns
a new Json consisting of all array elements of this Json and those key/value pairs that satisfy the given predicate p.
- abstract def flatten: LazyList[(JsPath, JsValue)]
- abstract 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
- JsValue
- abstract def init: T
The initial part of the Json object without its last element.
- abstract def inserted(path: JsPath, value: JsValue, padWith: JsValue = JsNull): T
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.
- Note
inserted function unless updated, always inserts the given path/value pair
- abstract def isArr: Boolean
returns true if this is an array
returns true if this is an array
- Definition Classes
- JsValue
- abstract def isEmpty: Boolean
returns true if the Json is empty
returns true if the Json is empty
- returns
true if empty, false otherwise
- abstract def isObj: Boolean
returns true if this is an object
returns true if this is an object
- Definition Classes
- JsValue
- abstract def map[J <: JsValue](m: (JsPrimitive) => J): T
Builds a new Json by applying a function to all elements of this Json that are not Json.
Builds a new Json by applying a function to all elements of this Json that are not Json. When a Json is found, it it mapped recursively.
- J
type of the output of the map function
- m
the function to apply to each element. It accepts the value of each element
- returns
a new Json resulting from applying the given map function to each element of this Json that satisfies the filter and collecting the results.
- abstract def map[J <: JsValue](m: (JsPath, JsPrimitive) => J, p: (JsPath, JsPrimitive) => Boolean): T
Builds a new Json by applying a function to all elements of this Json that are not Json and satisfies a given predicate.
Builds a new Json by applying a function to all elements of this Json that are not Json and satisfies a given predicate. When a Json is found, it it mapped recursively.
- J
type of the output of the map function
- m
the function to apply to each element. The predicate accepts the path/value pair of each element
- p
filter to select which elements will be mapped. By default all the elements are selected.
- returns
a new Json resulting from applying the given map function to each element of this Json that satisfies the filter and collecting the results.
- abstract def mapKeys(m: (String) => String): T
Builds a new Json by applying a function to all the keys of this Json.
Builds a new Json by applying a function to all the keys of this Json. If the element associated to a key is a Json, the function is applied recursively,
- m
the function to apply to each key. It accepts the key name as a parameter
- abstract def mapKeys(m: (JsPath, JsValue) => String, p: (JsPath, JsValue) => Boolean): T
Builds a new Json by applying a function to all the keys of this Json that satisfies a given predicate.
Builds a new Json by applying a function to all the keys of this Json that satisfies a given predicate. If the element associated to a key is a Json, the function is applied recursively,
- m
the function to apply to each key. It accepts the path/value pair as parameters
- p
the predicate to select which keys will be mapped
- abstract def reduce[V](p: (JsPath, JsPrimitive) => Boolean, m: (JsPath, JsPrimitive) => V, r: (V, V) => V): Option[V]
- abstract def removed(path: JsPath): T
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
- abstract def removedAll(xs: IterableOnce[JsPath]): T
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.
- abstract def size: Int
- abstract def tail: T
The rest of the Json object without its first element.
- abstract 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
- JsValue
- Annotations
- @throws(classOf[value.UserError])
- abstract def toJsObj: 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
- JsValue
- Annotations
- @throws(classOf[value.UserError])
- abstract 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
- JsValue
- Annotations
- @throws(classOf[value.UserError])
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- 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
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
return false
- def isBigInt: Boolean
return false
- def isBool: Boolean
return false
- 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
return false
- 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
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isInt: Boolean
return false
- 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
return false
- 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
- 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 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
- 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
return false
- def isNull: Boolean
return false
- def isNumber: Boolean
return false
- 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
return false
- 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
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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
- 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
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toJsBigDec: JsBigDec
throws an UserError exception
- def toJsBigInt: JsBigInt
throws an UserError exception
- def toJsBool: JsBool
throws an UserError exception
- def toJsDouble: JsDouble
throws an UserError exception
- def toJsInt: JsInt
throws an UserError exception
- def toJsLong: JsLong
throws an UserError exception
- def toJsNull: JsNull.type
throws an UserError exception
- def toJsNumber: JsNumber
throws an UserError exception
- def toJsStr: JsStr
throws an UserError exception
- 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
- def toString(): String
Returns the string representation of this Json
Returns the string representation of this Json
- returns
the string representation of this Json
- Definition Classes
- Json → AnyRef → Any
- 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()