Concatenate with another JSON.
Concatenate with another JSON. This is a concatenation monoid: (JValue, ++, JNothing)
Example:
JArray(JInt(1) :: JInt(2) :: Nil) ++ JArray(JInt(3) :: Nil) == JArray(List(JInt(1), JInt(2), JInt(3)))
XPath-like expression to query JSON fields by type.
XPath-like expression to query JSON fields by type. Matches only fields on next level.
Example:
json \ classOf[JInt]
XPath-like expression to query JSON fields by name.
XPath-like expression to query JSON fields by name. Matches only fields on next level.
Example:
json \ "name"
XPath-like expression to query JSON fields by type.
XPath-like expression to query JSON fields by type. Returns all matching fields.
Example:
json \\ classOf[JInt]
XPath-like expression to query JSON fields by name.
XPath-like expression to query JSON fields by name. Returns all matching fields.
Example:
json \\ "name"
Return nth element from JSON.
Return direct child elements.
Return direct child elements.
Example:
JArray(JInt(1) :: JInt(2) :: Nil).children == List(JInt(1), JInt(2))
Return a diff.
Return a diff.
net.liftweb.json.Diff#diff
Extract a value from a JSON.
Extract a value from a JSON.
Value can be:
Example:
case class Person(name: String) JObject(JField("name", JString("joe")) :: Nil).extract[Person] == Person("joe")
Extract a value from a JSON.
Extract a value from a JSON.
Value can be:
Example:
case class Person(name: String) JObject(JField("name", JString("joe")) :: Nil).extractOpt[Person] == Some(Person("joe"))
Extract a value from a JSON using a default value.
Extract a value from a JSON using a default value.
Value can be:
Example:
case class Person(name: String) JNothing.extractOrElse(Person("joe")) == Person("joe")
Return a List of all elements which matches the given predicate.
Return a List of all elements which matches the given predicate.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) filter { case JInt(x) => x > 1; case _ => false }
Return the first element from JSON which matches the given predicate.
Return the first element from JSON which matches the given predicate.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) find { _ == JInt(2) } == Some(JInt(2))
Return a combined value by folding over JSON by applying a function f
for each element.
Return a combined value by folding over JSON by applying a function f
for each element. The initial value is z
.
Return a new JValue resulting from applying the given function f
to each element in JSON.
Return a new JValue resulting from applying the given function f
to each element in JSON.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) map { case JInt(x) => JInt(x+1); case x => x }
Return a JSON where all elements matching the given predicate are removed.
Return a JSON where all elements matching the given predicate are removed.
Example:
JArray(JInt(1) :: JInt(2) :: JNull :: Nil) remove { _ == JNull }
Return a new JValue resulting from replacing the value at the specified field path with the replacement value provided.
Return a new JValue resulting from replacing the value at the specified field path with the replacement value provided. This has no effect if the path is empty or if the value is not a JObject instance.
Example:
JObject(List(JField("foo", JObject(List(JField("bar", JInt(1))))))).replace("foo" :: "bar" :: Nil, JString("baz")) // returns JObject(List(JField("foo", JObject(List(JField("bar", JString("baz")))))))
Return a new JValue resulting from applying the given partial function f
to each element in JSON.
Return a new JValue resulting from applying the given partial function f
to each element in JSON.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) transform { case JInt(x) => JInt(x+1) }
Return unboxed values from JSON
To make 2.
To make 2.10 happy