JsonCodec

zio.schema.codec.JsonCodec
object JsonCodec

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
JsonCodec.type

Members list

Type members

Classlikes

object Codecs

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Codecs.type
final case class Configuration(explicitEmptyCollections: ExplicitConfig = ..., explicitNulls: ExplicitConfig = ..., discriminatorSettings: DiscriminatorSetting = ..., fieldNameFormat: NameFormat = ..., treatStreamsAsArrays: Boolean = ..., rejectExtraFields: Boolean = ...)

Configuration for the JSON codec. The configurations are overruled by the annotations that configure the same behavior.

Configuration for the JSON codec. The configurations are overruled by the annotations that configure the same behavior.

Value parameters

discriminatorSettings

set up how to handle discriminators

explicitEmptyCollections

whether to encode empty collections as [] or omit the field and decode the field when it is missing as an empty collection or fail

explicitNulls

whether to encode empty Options as null or omit the field and decode the field when it is missing to None or fail

fieldNameFormat

format for the field names

rejectExtraFields

whether to reject extra fields during decoding

treatStreamsAsArrays

whether to treat streams as arrays when encoding/decoding

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Configuration

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait DiscriminatorSetting

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ClassName
class Name
case class ExplicitConfig(encoding: Boolean = ..., decoding: Boolean = ...)

When disabled for encoding, matching fields will be omitted from the JSON. When disabled for decoding, missing fields will be decoded as the default value.

When disabled for encoding, matching fields will be omitted from the JSON. When disabled for decoding, missing fields will be decoded as the default value.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object JsonDecoder

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object JsonEncoder

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Deprecated classlikes

final case class Config(ignoreEmptyCollections: Boolean, treatStreamsAsArrays: Boolean = ..., explicitNulls: Boolean = ...)

Attributes

Companion
object
Deprecated
[Since version 1.6.7] Use JsonCodec.Configuration instead.\nJsonCodec.Configuration makes it now possible to configure en-/decoding of empty collection and nulls (Options) independently.
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Config

Attributes

Companion
class
Deprecated
[Since version 1.6.7] Use JsonCodec.Configuration instead.\nJsonCodec.Configuration makes it now possible to configure en-/decoding of empty collection and nulls (Options) independently.
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Config.type

Value members

Concrete methods

def jsonCodec[A](schema: Schema[A]): JsonCodec[A]
def jsonCodec[A](cfg: Configuration)(schema: Schema[A]): JsonCodec[A]
def jsonDecoder[A](schema: Schema[A]): JsonDecoder[A]
def jsonDecoder[A](cfg: Configuration)(schema: Schema[A]): JsonDecoder[A]
def jsonEncoder[A](schema: Schema[A]): JsonEncoder[A]
def jsonEncoder[A](cfg: Configuration)(schema: Schema[A]): JsonEncoder[A]
def schemaBasedBinaryCodec[A](cfg: Configuration)(implicit schema: Schema[A]): BinaryCodec[A]

Deprecated methods

def jsonCodec[A](cfg: Config)(schema: Schema[A]): JsonCodec[A]

Attributes

Deprecated
[Since version 1.6.7] Use Configuration based method instead
def jsonEncoder[A](cfg: Config)(schema: Schema[A]): JsonEncoder[A]

Attributes

Deprecated
[Since version 1.6.7] Use Configuration based method instead
def schemaBasedBinaryCodec[A](cfg: Config)(implicit schema: Schema[A]): BinaryCodec[A]

Attributes

Deprecated
[Since version 1.6.7] Use Configuration based method instead

Concrete fields

Implicits

Implicits

implicit def schemaBasedBinaryCodec[A](implicit schema: Schema[A]): BinaryCodec[A]
implicit def zioJsonBinaryCodec[A](implicit jsonCodec: JsonCodec[A]): BinaryCodec[A]