JsonCodec

zio.schema.codec.JsonCodec
object JsonCodec

Attributes

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

Members list

Type members

Classlikes

object Codecs

Attributes

Source
JsonCodec.scala
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
Source
JsonCodec.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Configuration

Attributes

Companion
class
Source
JsonCodec.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
JsonCodec.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait DiscriminatorSetting

Attributes

Companion
object
Source
JsonCodec.scala
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

Source
JsonCodec.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object JsonDecoder

Attributes

Source
JsonCodec.scala
Supertypes
class Object
trait Matchable
class Any
Self type
object JsonEncoder

Attributes

Source
JsonCodec.scala
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.
Source
JsonCodec.scala
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.
Source
JsonCodec.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Config.type

Types

Attributes

Source
JsonCodec.scala

Value members

Concrete methods

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

Attributes

Source
JsonCodec.scala
def jsonCodec[A](cfg: Configuration)(schema: Schema[A]): JsonCodec[A]

Attributes

Source
JsonCodec.scala
def jsonDecoder[A](schema: Schema[A]): JsonDecoder[A]

Attributes

Source
JsonCodec.scala
def jsonDecoder[A](cfg: Configuration)(schema: Schema[A]): JsonDecoder[A]

Attributes

Source
JsonCodec.scala
def jsonEncoder[A](schema: Schema[A]): JsonEncoder[A]

Attributes

Source
JsonCodec.scala
def jsonEncoder[A](cfg: Configuration)(schema: Schema[A]): JsonEncoder[A]

Attributes

Source
JsonCodec.scala
def schemaBasedBinaryCodec[A](cfg: Configuration)(implicit schema: Schema[A]): BinaryCodec[A]

Attributes

Source
JsonCodec.scala

Deprecated methods

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

Attributes

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

Attributes

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

Attributes

Deprecated
[Since version 1.6.7] Use Configuration based method instead
Source
JsonCodec.scala

Concrete fields

Attributes

Source
JsonCodec.scala

Attributes

Source
JsonCodec.scala

Implicits

Implicits

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

Attributes

Source
JsonCodec.scala
implicit def zioJsonBinaryCodec[A](implicit jsonCodec: JsonCodec[A]): BinaryCodec[A]

Attributes

Source
JsonCodec.scala