net.liftweb.json.JsonAST

JValue

sealed abstract class JValue extends Diffable

Data type for Json AST.

Linear Supertypes
Diffable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JValue
  2. Diffable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new JValue()

Type Members

  1. abstract type Values

  2. final class WithFilter extends AnyRef

Abstract Value Members

  1. abstract def values: Values

    Return unboxed values from JSON

    Return unboxed values from JSON

    Example:

    JObject(JField("name", JString("joe")) :: Nil).values == Map("name" -> "joe")
    

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def ++(other: JValue): JValue

    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)))
    

  5. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  6. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  7. def \[A <: JValue](clazz: Class[A]): List[\.A.Values]

    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]
    

  8. def \(nameToFind: String): JValue

    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"
    

  9. def \\[A <: JValue](clazz: Class[A]): List[\\.A.Values]

    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]
    

  10. def \\(nameToFind: String): JValue

    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"
    

  11. def apply(i: Int): JValue

    Return nth element from JSON.

    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)
    

  12. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  13. def children: List[JValue]

    Return direct child elements.

    Return direct child elements.

    Example:

    JArray(JInt(1) :: JInt(2) :: Nil).children == List(JInt(1), JInt(2))
    

  14. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. def diff(other: json.JValue): Diff

    Return a diff.

    Return a diff.

    Definition Classes
    Diffable
    See also

    net.liftweb.json.Diff#diff

  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  18. def extract[A](implicit formats: Formats, mf: Manifest[A]): A

    Extract a value from a JSON.

    Extract a value from a JSON.

    Value can be:

    • case class
    • primitive (String, Boolean, Date, etc.)
    • supported collection type (List, Seq, Map[String, _], Set)
    • any type which has a configured custom deserializer

    Example:

    case class Person(name: String)
    JObject(JField("name", JString("joe")) :: Nil).extract[Person] == Person("joe")
    

  19. def extractOpt[A](implicit formats: Formats, mf: Manifest[A]): Option[A]

    Extract a value from a JSON.

    Extract a value from a JSON.

    Value can be:

    • case class
    • primitive (String, Boolean, Date, etc.)
    • supported collection type (List, Seq, Map[String, _], Set)
    • any type which has a configured custom deserializer

    Example:

    case class Person(name: String)
    JObject(JField("name", JString("joe")) :: Nil).extractOpt[Person] == Some(Person("joe"))
    

  20. def extractOrElse[A](default: ⇒ A)(implicit formats: Formats, mf: Manifest[A]): A

    Extract a value from a JSON using a default value.

    Extract a value from a JSON using a default value.

    Value can be:

    • case class
    • primitive (String, Boolean, Date, etc.)
    • supported collection type (List, Seq, Map[String, _], Set)
    • any type which has a configured custom deserializer

    Example:

    case class Person(name: String)
    JNothing.extractOrElse(Person("joe")) == Person("joe")
    

  21. def filter(p: (JValue) ⇒ Boolean): List[JValue]

    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 }
    

  22. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def find(p: (JValue) ⇒ Boolean): Option[JValue]

    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))
    

  24. def fold[A](z: A)(f: (A, JValue) ⇒ A): A

    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.

  25. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  27. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  28. def map(f: (JValue) ⇒ JValue): JValue

    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 }
    

  29. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  32. def remove(p: (JValue) ⇒ Boolean): JValue

    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 }
    

  33. def replace(l: List[String], replacement: JValue): JValue

    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")))))))
    

  34. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  35. def toOpt: Option[JValue]

  36. def toString(): String

    Definition Classes
    AnyRef → Any
  37. def transform(f: PartialFunction[JValue, JValue]): JValue

    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) }
    

  38. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. def withFilter(p: (JValue) ⇒ Boolean): WithFilter

    To make 2.

    To make 2.10 happy

Inherited from Diffable

Inherited from AnyRef

Inherited from Any

Ungrouped