package json4s
- Source
- package.scala
- Alphabetic
- By Inheritance
- json4s
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait BigDecimalJsonFormats extends DefaultJsonFormats with DefaultReaders with BigDecimalWriters
- trait BigDecimalWriters extends DefaultWriters
- class CustomKeySerializer[A] extends KeySerializer[A]
- class CustomSerializer[A] extends Serializer[A]
- trait DateFormat extends AnyRef
Conversions between String and Date.
- trait DefaultFormats extends Formats
- trait DefaultJsonFormats extends AnyRef
- trait DefaultReaders extends DefaultReaders0
- trait DefaultWriters extends AnyRef
- trait DoubleJsonFormats extends DefaultJsonFormats with DefaultReaders with DoubleWriters
- trait DoubleWriters extends DefaultWriters
- class DynamicJValue extends Dynamic
- trait DynamicJValueImplicits extends AnyRef
- class ExtractableJsonAstNode extends AnyRef
- case class FieldSerializer[A](serializer: PartialFunction[(String, Any), Option[(String, Any)]] = Map(), deserializer: PartialFunction[JField, JField] = Map(), includeLazyVal: Boolean = false)(implicit mf: 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") )
The third optional parameter "includeLazyVal" determines if serializer will serialize/deserialize lazy val fields or not.
- case class FileInput(file: File) extends JsonInput with Product with Serializable
- trait Formats extends Serializable
Formats to use when converting JSON.
Formats to use when converting JSON. Formats are usually configured by using an implicit parameter:
implicit val formats = org.json4s.DefaultFormats
- Annotations
- @implicitNotFound("No org.json4s.Formats found. Try to bring an instance of org.json4s.Formats in scope or use the org.json4s.DefaultFormats.")
- case class FullTypeHints(hints: List[Class[_]], typeHintFieldName: String = "jsonClass") extends TypeHints with Product with Serializable
Use full class name as a type hint.
- type JArray = json4s.JsonAST.JArray
- type JBool = json4s.JsonAST.JBool
- type JDecimal = json4s.JsonAST.JDecimal
- type JDouble = json4s.JsonAST.JDouble
- type JField = (String, json4s.JsonAST.JValue)
- type JInt = json4s.JsonAST.JInt
- type JLong = json4s.JsonAST.JLong
- type JObject = json4s.JsonAST.JObject
- type JSet = json4s.JsonAST.JSet
- type JString = json4s.JsonAST.JString
- type JValue = json4s.JsonAST.JValue
- trait JsonFormat[T] extends Writer[T] with Reader[T]
- Annotations
- @implicitNotFound("No Json formatter found for type ${T}. Try to implement an implicit JsonFormat for this type.")
- sealed abstract class JsonInput extends Product with Serializable
- trait JsonMethods[T] extends AnyRef
- abstract class JsonUtil extends AnyRef
- trait JsonWriter[T] extends AnyRef
- trait KeySerializer[A] extends AnyRef
- case class MappedTypeHints(hintMap: Map[Class[_], String], typeHintFieldName: String = "jsonClass") extends TypeHints with Product with Serializable
Use a map of keys as type hints.
Use a map of keys as type hints. Values may not be mapped by multiple keys
- case class MappingException(msg: String, cause: Exception) extends Exception with Product with Serializable
- class MonadicJValue extends AnyRef
- trait ParameterNameReader extends json4s.reflect.ParameterNameReader
- trait Reader[T] extends AnyRef
- Annotations
- @implicitNotFound("No JSON deserializer found for type ${T}. Try to implement an implicit Reader or JsonFormat for this type.")
- case class ReaderInput(reader: java.io.Reader) extends JsonInput with Product with Serializable
- trait RichSerializer[A] extends AnyRef
- trait Serialization extends AnyRef
- trait Serializer[A] extends AnyRef
- case class ShortTypeHints(hints: List[Class[_]], typeHintFieldName: String = "jsonClass") extends TypeHints with Product with Serializable
Use short class name as a type hint.
- case class StreamInput(stream: InputStream) extends JsonInput with Product with Serializable
- case class StringInput(string: String) extends JsonInput with Product with Serializable
- class ToJsonWritable[T] extends AnyRef
- 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)
- type TypeInfo = json4s.reflect.TypeInfo
- trait Writer[-T] extends AnyRef
- Annotations
- @implicitNotFound("No JSON serializer found for type ${T}. Try to implement an implicit Writer or JsonFormat for this type.")
Value Members
- val JArray: json4s.JsonAST.JArray.type
- val JBool: json4s.JsonAST.JBool.type
- val JDecimal: json4s.JsonAST.JDecimal.type
- val JDouble: json4s.JsonAST.JDouble.type
- val JField: json4s.JsonAST.JField.type
- val JInt: json4s.JsonAST.JInt.type
- val JLong: json4s.JsonAST.JLong.type
- val JNothing: json4s.JsonAST.JNothing.type
- val JNull: json4s.JsonAST.JNull.type
- val JObject: json4s.JsonAST.JObject.type
- val JSet: json4s.JsonAST.JSet.type
- val JString: json4s.JsonAST.JString.type
- val TypeInfo: json4s.reflect.TypeInfo.type
- implicit def file2JsonInput(file: File): JsonInput
- implicit def jsonwritable[T](a: T)(implicit arg0: Writer[T]): ToJsonWritable[T]
- implicit def jvalue2extractable(jv: JValue): ExtractableJsonAstNode
- implicit def jvalue2monadic(jv: JValue): MonadicJValue
- implicit def reader2JsonInput(rdr: java.io.Reader): JsonInput
- implicit def stream2JsonInput(stream: InputStream): JsonInput
- implicit def string2JsonInput(s: String): JsonInput
- object BigDecimalJsonFormats extends BigDecimalJsonFormats
- object BigDecimalWriters extends BigDecimalWriters
- object DefaultFormats extends DefaultFormats
Default date format is UTC time.
- object DefaultJsonFormats extends DoubleJsonFormats
- object DefaultReaders extends DefaultReaders
- object DefaultWriters extends DoubleWriters
- object DoubleJsonFormats extends DoubleJsonFormats
- object DoubleWriters extends DoubleWriters
- object DynamicJValue extends DynamicJValueImplicits
- 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
- object FieldSerializer extends Serializable
- object Formats extends Serializable
- object JsonWriter
- case object NoTypeHints extends TypeHints with Product with Serializable
Do not use any type hints.
- object ParserUtil