Object

net.liftweb.json

JsonAST

Related Doc: package json

Permalink

object JsonAST

This object contains the abstract syntax tree (or AST) for working with JSON objects in lift-json.

The purpose of the JSON AST is to represent and manipulate JSON by leveraging Scala language features like types, case classes, etc. The AST should allow you to represent anything you could imagine from JSON land using the Scala type system.

Everything in the AST has a single root: JValue. A JValue could, quite literally, be anything. It could be an an object (represented by JObject), a string (JString), a null (JNull), and so on. So, when constructing a JSON object with the AST directly you might construct something like the following:

JObject(JField("bacon", JBool(true)) :: JField("spinach", JBool(false)))

Once serialized to the string representation of JSON you would end up with the following:

{
  "bacon":true,
  "spinach":false
}
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JsonAST
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

  1. case class JArray(arr: List[JValue]) extends JValue with Product with Serializable

    Permalink
  2. case class JBool(value: Boolean) extends JValue with Product with Serializable

    Permalink
  3. case class JDouble(num: Double) extends JValue with Product with Serializable

    Permalink
  4. case class JField(name: String, value: JValue) extends Product with Serializable

    Permalink
  5. case class JInt(num: BigInt) extends JValue with Product with Serializable

    Permalink
  6. case class JObject(obj: List[JField]) extends JValue with Product with Serializable

    Permalink
  7. case class JString(s: String) extends JValue with Product with Serializable

    Permalink
  8. sealed abstract class JValue extends Diffable

    Permalink

    The base type for all things that represent distinct JSON entities in the AST.

    The base type for all things that represent distinct JSON entities in the AST.

    Most members of the AST will extend this class. The one exception is JField which does not extend this class because it really can't properly exist as a first-class citizen of JSON.

  9. case class RenderIntermediaryDocument(value: JValue) extends Product with Serializable

    Permalink
  10. case class RenderSettings(indent: Int, escapeChars: Set[Char] = Set(), spaceAfterFieldName: Boolean = false) extends Product with Serializable

    Permalink

    RenderSettings allows for customizing how JSON is rendered to a String.

    RenderSettings allows for customizing how JSON is rendered to a String. At the moment, you can customize the indentation (if 0, all the JSON is printed on one line), the characters that should be escaped (in addition to a base set that will always be escaped for valid JSON), and whether or not a space should be included after a field name.

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object JNothing extends JValue with Product with Serializable

    Permalink
  5. object JNull extends JValue with Product with Serializable

    Permalink
  6. object JObject extends Product with Serializable

    Permalink
  7. object JValue extends Mergeable

    Permalink
  8. object RenderSettings extends Serializable

    Permalink
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def compactRender(value: JValue, appendable: Appendable): String

    Permalink

    Render value to the given appendable using RenderSettings.compact.

  12. def compactRender(value: JValue): String

    Permalink

    Renders JSON directly to string in compact format.

    Renders JSON directly to string in compact format. This is an optimized version of compact(render(value)) when the intermediate Document is not needed.

  13. def concat(values: JValue*): JValue

    Permalink

    Concatenate a sequence of JValues together.

    Concatenate a sequence of JValues together.

    This would be useful in the event that you have a handful of JValue instances that need to be smacked together into one unit.

    For example:

    concat(JInt(1), JInt(2)) == JArray(List(JInt(1), JInt(2)))
  14. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

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

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

    Permalink
    Definition Classes
    Any
  20. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. def prettyRender(value: JValue, appendable: Appendable): String

    Permalink

    Render value to the given appendable using RenderSettings.pretty.

  24. def prettyRender(value: JValue): String

    Permalink

    Render value using RenderSettings.pretty.

  25. def render(value: JValue): RenderIntermediaryDocument

    Permalink
  26. def render(value: JValue, settings: RenderSettings, appendable: Appendable = new StringBuilder()): String

    Permalink

    Render value to the given appendable (a StringBuilder, by default) using the given settings.

    Render value to the given appendable (a StringBuilder, by default) using the given settings. The appendable's toString will be called and the result will be returned.

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

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped