- Companion:
- object
- Source:
- DynamicJValue.scala
Type members
Types
Value members
Abstract methods
Return unboxed values from JSON
Return unboxed values from JSON
Example:
JObject(JField("name", JString("joe")) :: Nil).values == Map("name" -> "joe")
- Source:
- JValue.scala
Concrete methods
Concatenate with another JSON. This is a concatenation monoid: (JValue, ++, JNothing)
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)))
- Source:
- JValue.scala
XPath-like expression to query JSON fields by name. Matches only fields on next level.
XPath-like expression to query JSON fields by name. Matches only fields on next level.
Example:
json \ "name"
- Source:
- MonadicJValue.scala
XPath-like expression to query JSON fields by type. Matches only fields on next level.
XPath-like expression to query JSON fields by type. Matches only fields on next level.
Example:
json \ classOf[JInt]
- Source:
- MonadicJValue.scala
XPath-like expression to query JSON fields by name. Returns all matching fields.
XPath-like expression to query JSON fields by name. Returns all matching fields.
Example:
json \\ "name"
- Source:
- MonadicJValue.scala
XPath-like expression to query JSON fields by type. Returns all matching fields.
XPath-like expression to query JSON fields by type. Returns all matching fields.
Example:
json \\ classOf[JInt]
- Source:
- MonadicJValue.scala
Return nth element from JSON. Meaningful only to JArray, JObject and JField. Returns JNothing for other types.
Return nth element from JSON. Meaningful only to JArray, JObject and JField. Returns JNothing for other types.
Example:
JArray(JInt(1) :: JInt(2) :: Nil)(1) == JInt(2)
- Source:
- JValue.scala
Camelize all the keys in this org.json4s.JValue
Camelize all the keys in this org.json4s.JValue
- Source:
- MonadicJValue.scala
Return direct child elements.
Return direct child elements.
Example:
JArray(JInt(1) :: JInt(2) :: Nil).children == List(JInt(1), JInt(2))
- Source:
- JValue.scala
Return a List of all values which matches the given predicate.
Return a List of all values which matches the given predicate.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) filter { case JInt(x) => x > 1; case _ => false }
- Source:
- MonadicJValue.scala
Return a List of all fields which matches the given predicate.
Return a List of all fields which matches the given predicate.
Example:
JObject(("age", JInt(10)) :: Nil) filterField { case ("age", JInt(x)) if x > 18 => true case _ => false }
- Source:
- MonadicJValue.scala
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))
- Source:
- MonadicJValue.scala
Return the first field from JSON which matches the given predicate.
Return the first field from JSON which matches the given predicate.
Example:
JObject(("age", JInt(2))) findField { case (n, v) => n == "age" }
- Source:
- MonadicJValue.scala
Return a combined value by folding over JSON by applying a function f
for each element. The initial value is z
.
Return a combined value by folding over JSON by applying a function f
for each element. The initial value is z
.
- Source:
- MonadicJValue.scala
Return a combined value by folding over JSON by applying a function f
for each field. The initial value is z
.
Return a combined value by folding over JSON by applying a function f
for each field. The initial value is z
.
- Source:
- MonadicJValue.scala
Return a new JValue resulting from applying the given function f
to each value in JSON.
Return a new JValue resulting from applying the given function f
to each value in JSON.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) map { case JInt(x) => JInt(x+1) case x => x }
- Source:
- MonadicJValue.scala
Return a new JValue resulting from applying the given function f
to each field in JSON.
Return a new JValue resulting from applying the given function f
to each field in JSON.
Example:
JObject(("age", JInt(10)) :: Nil) mapField { case ("age", JInt(x)) => ("age", JInt(x+1)) case x => x }
- Source:
- MonadicJValue.scala
Remove the org.json4s.JNothing and org.json4s.JNull from a org.json4s.JArray or org.json4s.JObject
Remove the org.json4s.JNothing and org.json4s.JNull from a org.json4s.JArray or org.json4s.JObject
- Source:
- MonadicJValue.scala
Pascalize all the keys in this org.json4s.JValue
Pascalize all the keys in this org.json4s.JValue
- Source:
- MonadicJValue.scala
Return a JSON where all values matching the given predicate are removed.
Return a JSON where all values matching the given predicate are removed.
Example:
JArray(JInt(1) :: JInt(2) :: JNull :: Nil) remove { _ == JNull }
- Source:
- MonadicJValue.scala
Return a JSON where all fields matching the given predicate are removed.
Return a JSON where all fields matching the given predicate are removed.
Example:
JObject(("age", JInt(10)) :: Nil) removeField { case ("age", _) => true case _ => false }
- Source:
- MonadicJValue.scala
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 or JArray instance. If the path is a JArray you must use the following annotation "foo[]", each element, or foo[index], one element.
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 or JArray instance. If the path is a JArray you must use the following annotation "foo[]", each element, or foo[index], one element.
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")))))))
JObject(List(JField("foo", JArray(List(JObject(List(JField("bar", JInt(1)))), JObject(List(JField("bar", JInt(2))))))))).replace("foo[]" :: "bar" :: Nil, JString("baz")) // returns JObject(List((foo,JArray(List(JObject(List((bar,JString(baz)))), JObject(List((bar,JString(baz)))))))))
JObject(List(JField("foo", JArray(List(JObject(List(JField("bar", JInt(1)))), JObject(List(JField("bar", JInt(2))))))))).replace("foo[0]" :: "bar" :: Nil, JString("baz")) // returns JObject(List((foo,JArray(List(JObject(List((bar,JString(baz)))), JObject(List((bar,JInt(2)))))))))
- Source:
- MonadicJValue.scala
Adds dynamic style to JValues. Only meaningful for JObjects
Adds dynamic style to JValues. Only meaningful for JObjects
Example:
JObject(JField("name",JString("joe"))::Nil).name == JString("joe")
- Source:
- DynamicJValue.scala
Underscore all the keys in this org.json4s.JValue
Underscore all the keys in this org.json4s.JValue
- Source:
- MonadicJValue.scala
When this org.json4s.JValue is a org.json4s.JNothing or a org.json4s.JNull, this method returns scala.None When it has a value it will return scala.Some
When this org.json4s.JValue is a org.json4s.JNothing or a org.json4s.JNull, this method returns scala.None When it has a value it will return scala.Some
- Source:
- JValue.scala
When this org.json4s.JValue is a org.json4s.JNothing, this method returns scala.None When it has a value it will return scala.Some
When this org.json4s.JValue is a org.json4s.JNothing, this method returns scala.None When it has a value it will return scala.Some
- Source:
- JValue.scala
Return a new JValue resulting from applying the given partial function f
to each value in JSON.
Return a new JValue resulting from applying the given partial function f
to each value in JSON.
Example:
JArray(JInt(1) :: JInt(2) :: Nil) transform { case JInt(x) => JInt(x+1) }
- Source:
- MonadicJValue.scala
Return a new JValue resulting from applying the given partial function f
to each field in JSON.
Return a new JValue resulting from applying the given partial function f
to each field in JSON.
Example:
JObject(("age", JInt(10)) :: Nil) transformField { case ("age", JInt(x)) => ("age", JInt(x+1)) }
- Source:
- MonadicJValue.scala
Underscore the camel cased only keys in this org.json4s.JValue
Underscore the camel cased only keys in this org.json4s.JValue
- Source:
- MonadicJValue.scala
Underscore all the keys in this org.json4s.JValue
Underscore all the keys in this org.json4s.JValue
- Source:
- MonadicJValue.scala
Inherited methods
Return a diff.
Return a diff.
- See also:
org.json4s.Diff#diff
- Inherited from:
- Diffable
- Source:
- Diff.scala