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. sealed trait DoubleRenderer extends (Double) ⇒ String

    Permalink

    Parent trait for double renderers, which decide how doubles contained in a JDouble are rendered to JSON string.

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

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

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

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

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

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

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

    Permalink
  9. 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.

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

    Permalink
  11. case class RenderSettings(indent: Int, escapeChars: Set[Char] = Set(), spaceAfterFieldName: Boolean = false, doubleRenderer: DoubleRenderer = RenderSpecialDoubleValuesAsNull) 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 FailToRenderSpecialDoubleValues extends DoubleRenderer with Product with Serializable

    Permalink

    A DoubleRenderer that throws an IllegalArgumentException when the special values NaN, -Infinity, and Infinity are encountered.

    A DoubleRenderer that throws an IllegalArgumentException when the special values NaN, -Infinity, and Infinity are encountered. Other doubles are rendered normally using toString.

  5. object JNothing extends JValue with Product with Serializable

    Permalink
  6. object JNull extends JValue with Product with Serializable

    Permalink
  7. object JObject extends Product with Serializable

    Permalink
  8. object JValue extends Mergeable

    Permalink
  9. object RenderSettings extends Serializable

    Permalink
  10. object RenderSpecialDoubleValuesAsIs extends DoubleRenderer with Product with Serializable

    Permalink

    A DoubleRenderer that renders special values NaN, -Infinity, and Infinity as-is using toString.

    A DoubleRenderer that renders special values NaN, -Infinity, and Infinity as-is using toString. This is not valid JSON, meaning JSON libraries generally won't be able to parse it (including lift-json!), but JavaScript can eval it. Other double values are also rendered the same way.

    Usage is not recommended.

  11. object RenderSpecialDoubleValuesAsNull extends DoubleRenderer with Product with Serializable

    Permalink

    A DoubleRenderer that renders special values NaN, -Infinity, and Infinity as null.

    A DoubleRenderer that renders special values NaN, -Infinity, and Infinity as null. Other doubles are rendered normally using toString.

  12. final def asInstanceOf[T0]: T0

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

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

    Permalink

    Render value to the given appendable using RenderSettings.compact.

  15. 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.

  16. 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)))
  17. final def eq(arg0: AnyRef): Boolean

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

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

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

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

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

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

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

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

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

    Permalink

    Render value to the given appendable using RenderSettings.pretty.

  27. def prettyRender(value: JValue): String

    Permalink

    Render value using RenderSettings.pretty.

  28. def render(value: JValue): RenderIntermediaryDocument

    Permalink
  29. 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.

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

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Ungrouped