ZioJsonSupport

com.github.pjfanning.pekkohttpziojson.ZioJsonSupport
See theZioJsonSupport companion object

JSON marshalling/unmarshalling using zio-json codec implicits.

The marshaller writes A to JSON HTTPEntity.

The unmarshaller follows zio-json's early exit strategy, attempting to reading JSON to an A.

A safe unmarshaller is provided to attempt reading JSON to an Either[String, A] instead.

No intermediate JSON representation as per zio-json's design.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Type members

Types

type SourceOf[A] = Source[A, _]

Value members

Concrete methods

def mediaTypes: Seq[WithFixedCharset]
def unmarshallerContentTypes: Seq[ContentTypeRange]

Implicits

Implicits

final implicit def fromByteStringUnmarshaller[A](implicit jd: JsonDecoder[A], rt: Runtime[Any]): Unmarshaller[ByteString, A]

ByteString => A

ByteString => A

Type parameters

A

type to decode

Attributes

final implicit def marshaller[A : JsonEncoder]: ToEntityMarshaller[A]

A => HTTP entity

A => HTTP entity

Type parameters

A

type to encode

Attributes

Returns

marshaller for any A value

final implicit def safeUnmarshaller[A : JsonDecoder]: FromEntityUnmarshaller[Either[String, A]]
final implicit def sourceMarshaller[A](implicit writes: JsonEncoder[A], support: JsonEntityStreamingSupport): ToEntityMarshaller[SourceOf[A]]

SourceOf[A] => HTTP entity

SourceOf[A] => HTTP entity

Type parameters

A

type to encode

Attributes

Returns

marshaller for any SourceOf[A] value

final implicit def sourceUnmarshaller[A : JsonDecoder, RT : Runtime](implicit evidence$1: JsonDecoder[A], evidence$2: Runtime[RT], support: JsonEntityStreamingSupport): FromEntityUnmarshaller[SourceOf[A]]

HTTP entity => Source[A, _]

HTTP entity => Source[A, _]

Type parameters

A

type to decode

Attributes

Returns

unmarshaller from Source[A, _]

final implicit def unmarshaller[A : JsonDecoder, RT : Runtime]: FromEntityUnmarshaller[A]

HTTPEntity => A

HTTPEntity => A

Type parameters

A

type to decode

Attributes

Returns

unmarshaller for A