AdditionalFormats

sjsonnew.AdditionalFormats

Provides additional JsonFormats and helpers

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

def asSingleton[A](a: A): JsonFormat[A]

A JsonFormat that doesn't write and always return this instance of a.

A JsonFormat that doesn't write and always return this instance of a.

Attributes

def contramapKeyWriter[A, B](f: B => A)(implicit ev: JsonKeyWriter[A]): JsonKeyWriter[B]

A JsonKeyWriter that can read an instance of B by using a JsonKeyWriter for A.

A JsonKeyWriter that can read an instance of B by using a JsonKeyWriter for A.

Attributes

def contramapWriter[A, B](f: B => A)(implicit ev: JsonWriter[A]): JsonWriter[B]

A JsonWriter that can read an instance of B by using a JsonWriter for A.

A JsonWriter that can read an instance of B by using a JsonWriter for A.

Attributes

def jsonFormat[A](reader: JsonReader[A], writer: JsonWriter[A]): JsonFormat[A]

Constructs a JsonFormat from its two parts, JsonReader and JsonWriter.

Constructs a JsonFormat from its two parts, JsonReader and JsonWriter.

Attributes

def lazyFormat[A](format: => JsonFormat[A]): JsonFormat[A]

Lazy wrapper around serialization. Useful when you want to serialize (mutually) recursive structures.

Lazy wrapper around serialization. Useful when you want to serialize (mutually) recursive structures.

Attributes

def liftFormat[A](writer: JsonWriter[A]): JsonFormat[A]

Turns a JsonWriter into a JsonFormat that throws an UnsupportedOperationException for reads.

Turns a JsonWriter into a JsonFormat that throws an UnsupportedOperationException for reads.

Attributes

def liftFormat[A](writer: RootJsonWriter[A]): RootJsonFormat[A]

Turns a RootJsonWriter into a RootJsonFormat that throws an UnsupportedOperationException for reads.

Turns a RootJsonWriter into a RootJsonFormat that throws an UnsupportedOperationException for reads.

Attributes

def liftFormat[A <: AnyRef](reader: JsonReader[A]): JsonFormat[A]

Turns a JsonReader into a JsonFormat that throws an UnsupportedOperationException for writes.

Turns a JsonReader into a JsonFormat that throws an UnsupportedOperationException for writes.

Attributes

def liftFormat[A <: AnyRef](reader: RootJsonReader[A]): RootJsonFormat[A]

Turns a RootJsonReader into a RootJsonFormat that throws an UnsupportedOperationException for writes.

Turns a RootJsonReader into a RootJsonFormat that throws an UnsupportedOperationException for writes.

Attributes

def mapKeyReader[A, B](f: A => B)(implicit ev: JsonKeyReader[A]): JsonKeyReader[B]

A JsonKeyReader that can read an instance of B by using a JsonKeyReader for A.

A JsonKeyReader that can read an instance of B by using a JsonKeyReader for A.

Attributes

def mapReader[A, B](f: A => B)(implicit ev: JsonReader[A]): JsonReader[B]

A JsonReader that can read an instance of B by using a JsonReader for A.

A JsonReader that can read an instance of B by using a JsonReader for A.

Attributes

def projectFormat[T, U](f1: T => U, f2: U => T)(implicit fu: JsonFormat[U]): JsonFormat[T]

A JsonFormat that can read and write an instance of T by using a JsonFormat for U.

A JsonFormat that can read and write an instance of T by using a JsonFormat for U.

Attributes

def rootFormat[A](format: JsonFormat[A]): RootJsonFormat[A]

Explicitly turns a JsonFormat into a RootJsonFormat.

Explicitly turns a JsonFormat into a RootJsonFormat.

Attributes

def rootJsonFormat[T](reader: RootJsonReader[T], writer: RootJsonWriter[T]): RootJsonFormat[T]

Constructs a RootJsonFormat from its two parts, RootJsonReader and RootJsonWriter.

Constructs a RootJsonFormat from its two parts, RootJsonReader and RootJsonWriter.

Attributes

def safeReader[A : JsonReader]: JsonReader[Either[Exception, A]]

Wraps an existing JsonReader with Exception protection.

Wraps an existing JsonReader with Exception protection.

Attributes