spray.json

package spray.json

Type members

Classlikes

Provides additional JsonFormats and helpers

Provides additional JsonFormats and helpers

Provides the JsonFormats for the most important Scala types.

Provides the JsonFormats for the most important Scala types.

A JsonPrinter that produces compact JSON source without any superfluous whitespace.

A JsonPrinter that produces compact JSON source without any superfluous whitespace.

Companion
object
Companion
class

Provides all the predefined JsonFormats.

Provides all the predefined JsonFormats.

Companion
object
case
class DeserializationException(msg: String, cause: Throwable, fieldNames: List[String]) extends RuntimeException
case
class JsArray(elements: Vector[JsValue]) extends JsValue

A JSON array.

A JSON array.

Companion
object
object JsArray
Companion
class
sealed abstract
class JsBoolean extends JsValue

JSON Booleans.

JSON Booleans.

Companion
object
object JsBoolean
Companion
class
case
object JsFalse extends JsBoolean
case
object JsNull extends JsValue

The representation for JSON null.

The representation for JSON null.

case
class JsNumber(value: BigDecimal) extends JsValue

A JSON number.

A JSON number.

Companion
object
object JsNumber
Companion
class
case
class JsObject(fields: Map[String, JsValue]) extends JsValue

A JSON object.

A JSON object.

Companion
object
object JsObject
Companion
class
case
class JsString(value: String) extends JsValue

A JSON string.

A JSON string.

Companion
object
object JsString
Companion
class
case
object JsTrue extends JsBoolean
sealed abstract
class JsValue

The general type of a JSON AST node.

The general type of a JSON AST node.

trait JsonFormat[T] extends JsonReader[T] with JsonWriter[T]

Provides the JSON deserialization and serialization for type T.

Provides the JSON deserialization and serialization for type T.

object JsonParser

Fast, no-dependency parser for JSON as defined by http://tools.ietf.org/html/rfc4627.

Fast, no-dependency parser for JSON as defined by http://tools.ietf.org/html/rfc4627.

Companion
class
class JsonParser(input: ParserInput, settings: JsonParserSettings)
Companion
object
sealed

Allows to customize settings for the JSON parser.

Allows to customize settings for the JSON parser.

Use it like this:

val customSettings =
 JsonParserSettings.default
   .withMaxDepth(100)
   .withMaxNumberCharacters(20)

JsonParser(jsonString, customSettings)
// or
jsonString.parseJson(customSettings)
Companion
object
Companion
class
trait JsonPrinter extends JsValue => String

A JsonPrinter serializes a JSON AST to a String.

A JsonPrinter serializes a JSON AST to a String.

Companion
object
Companion
class
@implicitNotFound(msg = "Cannot find JsonReader or JsonFormat type class for ${T}")
trait JsonReader[T]

Provides the JSON deserialization for type T.

Provides the JSON deserialization for type T.

Companion
object
object JsonReader
Companion
class
@implicitNotFound(msg = "Cannot find JsonWriter or JsonFormat type class for ${T}")
trait JsonWriter[T]

Provides the JSON serialization for type T.

Provides the JSON serialization for type T.

Companion
object
object JsonWriter
Companion
class

This trait supplies an alternative rendering mode for optional case class members. Normally optional members that are undefined (None) are not rendered at all. By mixing in this trait into your custom JsonProtocol you can enforce the rendering of undefined members as null. (Note that this only affect JSON writing, spray-json will always read missing optional members as well as null optional members as None.)

This trait supplies an alternative rendering mode for optional case class members. Normally optional members that are undefined (None) are not rendered at all. By mixing in this trait into your custom JsonProtocol you can enforce the rendering of undefined members as null. (Note that this only affect JSON writing, spray-json will always read missing optional members as well as null optional members as None.)

Companion
object
Companion
class

A JsonPrinter that produces a nicely readable JSON source.

A JsonPrinter that produces a nicely readable JSON source.

Companion
object
Companion
class

Provides the helpers for constructing custom JsonFormat implementations for types implementing the Product trait (especially case classes)

Provides the helpers for constructing custom JsonFormat implementations for types implementing the Product trait (especially case classes)

Companion
object
Companion
class
trait RootJsonFormat[T] extends JsonFormat[T] with RootJsonReader[T] with RootJsonWriter[T]

A special JsonFormat signaling that the format produces a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonFormat signaling that the format produces a legal JSON root object, i.e. either a JSON array or a JSON object.

@implicitNotFound(msg = "Cannot find RootJsonReader or RootJsonFormat type class for ${T}")
trait RootJsonReader[T] extends JsonReader[T]

A special JsonReader capable of reading a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonReader capable of reading a legal JSON root object, i.e. either a JSON array or a JSON object.

@implicitNotFound(msg = "Cannot find RootJsonWriter or RootJsonFormat type class for ${T}")
trait RootJsonWriter[T] extends JsonWriter[T]

A special JsonWriter capable of writing a legal JSON root object, i.e. either a JSON array or a JSON object.

A special JsonWriter capable of writing a legal JSON root object, i.e. either a JSON array or a JSON object.

class SerializationException(msg: String) extends RuntimeException
Companion
object
Companion
class

Provides the JsonFormats for the non-collection standard types.

Provides the JsonFormats for the non-collection standard types.

Types

type JsField = (String, JsValue)

Value members

Concrete methods

def deserializationError(msg: String, cause: Throwable, fieldNames: List[String]): Nothing
def jsonReader[T](implicit reader: JsonReader[T]): JsonReader[T]
def jsonWriter[T](implicit writer: JsonWriter[T]): JsonWriter[T]
def serializationError(msg: String): Nothing

Deprecated methods

@deprecated("use enrichAny", "1.3.4")
def pimpAny[T](any: T): PimpedAny[T]
Deprecated
@deprecated("use enrichString", "1.3.4")
def pimpString(string: String): PimpedString
Deprecated

Implicits

Implicits

implicit
def enrichAny[T](any: T): RichAny[T]
implicit
def enrichString(string: String): RichString