Packages

package json

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. json
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class CustomSerializer [A] extends Serializer[A]
  2. trait DateFormat extends AnyRef

    Conversions between String and Date.

  3. trait DefaultFormats extends Formats
  4. case class Diff (changed: JValue, added: JValue, deleted: JValue) extends Product with Serializable

    A difference between two JSONs (j1 diff j2).

    A difference between two JSONs (j1 diff j2).

    changed

    what has changed from j1 to j2

    added

    what has been added to j2

    deleted

    what has been deleted from j1

  5. case class FieldSerializer [A](serializer: PartialFunction[(String, Any), Option[(String, Any)]] = Map(), deserializer: PartialFunction[JField, JField] = Map())(implicit evidence$1: Manifest[A]) extends Product with Serializable

    Serializer which serializes all fields of a class too.

    Serializer which serializes all fields of a class too.

    Serialization can be intercepted by giving two optional PartialFunctions as constructor parameters:

    FieldSerializer[WildDog](
      renameTo("name", "animalname") orElse ignore("owner"),
      renameFrom("animalname", "name")
    )
    

  6. trait Formats extends AnyRef

    Formats to use when converting JSON.

    Formats to use when converting JSON. Formats are usually configured by using an implicit parameter:

    implicit val formats = net.liftweb.json.DefaultFormats
    

  7. case class FullTypeHints (hints: List[Class[_]]) extends TypeHints with Product with Serializable

    Use full class name as a type hint.

  8. trait Implicits extends AnyRef
  9. type JArray = json.JsonAST.JArray
  10. type JBool = json.JsonAST.JBool
  11. type JDouble = json.JsonAST.JDouble
  12. type JField = json.JsonAST.JField
  13. type JInt = json.JsonAST.JInt
  14. type JObject = json.JsonAST.JObject
  15. type JString = json.JsonAST.JString
  16. type JValue = json.JsonAST.JValue
  17. trait JsonDSL extends Implicits
  18. case class MappingException (msg: String, cause: Exception) extends Exception with Product with Serializable
  19. trait ParameterNameReader extends AnyRef
  20. trait Serializer [A] extends AnyRef
  21. case class ShortTypeHints (hints: List[Class[_]]) extends TypeHints with Product with Serializable

    Use short class name as a type hint.

  22. trait TypeHints extends AnyRef

    Type hints can be used to alter the default conversion rules when converting Scala instances into JSON and vice versa.

    Type hints can be used to alter the default conversion rules when converting Scala instances into JSON and vice versa. Type hints must be used when converting class which is not supported by default (for instance when class is not a case class).

    Example:

    class DateTime(val time: Long)
    
    val hints = new ShortTypeHints(classOf[DateTime] :: Nil) {
      override def serialize: PartialFunction[Any, JObject] = {
        case t: DateTime => JObject(JField("t", JInt(t.time)) :: Nil)
      }
    
      override def deserialize: PartialFunction[(String, JObject), Any] = {
        case ("DateTime", JObject(JField("t", JInt(t)) :: Nil)) => new DateTime(t.longValue)
      }
    }
    implicit val formats = DefaultFormats.withHints(hints)
    

  23. case class TypeInfo (clazz: Class[_], parameterizedType: Option[ParameterizedType]) extends Product with Serializable

Value Members

  1. val JArray: json.JsonAST.JArray.type
  2. val JBool: json.JsonAST.JBool.type
  3. val JDouble: json.JsonAST.JDouble.type
  4. val JField: json.JsonAST.JField.type
  5. val JInt: json.JsonAST.JInt.type
  6. val JNothing: json.JsonAST.JNothing.type
  7. val JNull: json.JsonAST.JNull.type
  8. val JObject: json.JsonAST.JObject.type
  9. val JString: json.JsonAST.JString.type
  10. def compactRender(value: JValue): String
  11. def parse(s: String): JValue
  12. def parseOpt(s: String): Option[JValue]
  13. def prettyRender(value: JValue): String
  14. object DefaultFormats extends DefaultFormats

    Default date format is UTC time.

  15. object Diff extends Serializable

    Computes a diff between two JSONs.

  16. object Extraction

    Function to extract values from JSON AST using case classes.

    Function to extract values from JSON AST using case classes.

    See: ExtractionExamples.scala

  17. object FieldSerializer extends Serializable
  18. object Implicits extends Implicits

    Basic implicit conversions from primitive types into JSON.

    Basic implicit conversions from primitive types into JSON. Example:

    import net.liftweb.json.Implicits._
    JObject(JField("name", "joe") :: Nil) == JObject(JField("name", JString("joe")) :: Nil)
    

  19. object JsonAST

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

    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
    }
  20. object JsonDSL extends JsonDSL

    A DSL to produce valid JSON.

    A DSL to produce valid JSON. Example:

    import net.liftweb.json.JsonDSL._
    ("name", "joe") ~ ("age", 15) == JObject(JField("name",JString("joe")) :: JField("age",JInt(15)) :: Nil)
    

  21. object JsonParser

    JSON parser.

  22. object Merge

    Function to merge two JSONs.

  23. object NoTypeHints extends TypeHints with Product with Serializable

    Do not use any type hints.

  24. object Serialization

    Functions to serialize and deserialize a case class.

    Functions to serialize and deserialize a case class. Custom serializer can be inserted if a class is not a case class.

    Example:

    val hints = new ShortTypeHints( ... )
    implicit val formats = Serialization.formats(hints)
    

    See also

    net.liftweb.json.TypeHints

  25. object Xml

    Functions to convert between JSON and XML.

Inherited from AnyRef

Inherited from Any

Ungrouped