zio.json

package zio.json

Members list

Packages

package zio.json.ast

Type members

Classlikes

case object BuildInfo

This object was generated by sbt-buildinfo.

This object was generated by sbt-buildinfo.

Attributes

Source
BuildInfo.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type
BuildInfo.type
case object CamelCase extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
CamelCase.type
case class CustomCase(f: String => String) extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
final implicit class DecoderByteArrayOps(json: Array[Byte]) extends AnyVal

Attributes

Source
package.scala
Supertypes
class AnyVal
trait Matchable
class Any
final implicit class DecoderBytesOps(json: Chunk[Byte]) extends AnyVal

Attributes

Source
package.scala
Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Source
JsonDecoderVersionSpecific.scala
Supertypes
class Object
trait Matchable
class Any
final implicit class DecoderOps(json: CharSequence) extends AnyVal

Attributes

Source
package.scala
Supertypes
class AnyVal
trait Matchable
class Any

Attributes

Source
macros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source
macros.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Source
macros.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final implicit class EncoderOps[A](a: A) extends AnyVal

Attributes

Source
package.scala
Supertypes
class AnyVal
trait Matchable
class Any
case class ExplicitEmptyCollections(encoding: Boolean = ..., decoding: Boolean = ...)

When disabled for decoding, keys with empty collections will be omitted from the JSON. When disabled for encoding, missing keys will default to empty collections.

When disabled for decoding, keys with empty collections will be omitted from the JSON. When disabled for encoding, missing keys will default to empty collections.

Attributes

Source
JsonCodecConfiguration.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
case object IdentityFormat extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
final case class JsonCodec[A](encoder: JsonEncoder[A], decoder: JsonDecoder[A])

A JsonCodec[A] instance has the ability to encode values of type A into JSON, together with the ability to decode such JSON into values of type A.

A JsonCodec[A] instance has the ability to encode values of type A into JSON, together with the ability to decode such JSON into values of type A.

Instances of this trait should satisfy round-tripping laws: that is, for every value, instances must be able to successfully encode the value into JSON, and then successfully decode the same value from such JSON.

For more information, see JsonDecoder and JsonEncoder.

{{ val intCodec: JsonCodec[Int] = JsonCodec[Int]

intCodec.encodeJson(intCodec.encodeJson(42)) == Right(42) }}

Attributes

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

Attributes

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

Attributes

Companion
class
Source
JsonCodecConfiguration.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class JsonCodecConfiguration(sumTypeHandling: SumTypeHandling = ..., fieldNameMapping: JsonMemberFormat = ..., allowExtraFields: Boolean = ..., sumTypeMapping: JsonMemberFormat = ..., explicitNulls: Boolean = ..., explicitEmptyCollections: ExplicitEmptyCollections = ..., enumValuesAsStrings: Boolean = ...)

Implicit codec derivation configuration.

Implicit codec derivation configuration.

Value parameters

allowExtraFields

see jsonNoExtraFields

enumValuesAsStrings

turns on serialization of enum values and sealed trait's case objects as strings

explicitEmptyCollections

turns on explicit serialization of fields with empty collections

explicitNulls

turns on explicit serialization of optional fields with None values

fieldNameMapping

see jsonMemberNames

sumTypeHandling

see jsonDiscriminator

sumTypeMapping

see jsonHintNames

Attributes

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

Attributes

Companion
trait
Source
JsonDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

A JsonDecoder[A] instance has the ability to decode JSON to values of type A, potentially failing with an error if the JSON content does not encode a value of the given type.

A JsonDecoder[A] instance has the ability to decode JSON to values of type A, potentially failing with an error if the JSON content does not encode a value of the given type.

Attributes

Companion
object
Source
JsonDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type

Attributes

Source
JsonDecoderPlatformSpecific.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait JsonDecoder[A]
Self type

Attributes

Companion
object
Source
JsonEncoder.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
object JsonEncoder

Attributes

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

Attributes

Source
JsonEncoderPlatformSpecific.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait JsonEncoder[A]
Self type
object JsonError

Attributes

Companion
class
Source
JsonError.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
JsonError.type
sealed abstract class JsonError

A JsonError value describes the ways in which decoding could fail. This structure is used to facilitate human-readable error messages during decoding failures.

A JsonError value describes the ways in which decoding could fail. This structure is used to facilitate human-readable error messages during decoding failures.

Attributes

Companion
object
Source
JsonError.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ArrayAccess
class Message
class ObjectAccess
class SumType
trait JsonFieldDecoder[+A]

When decoding a JSON Object, we only allow the keys that implement this interface.

When decoding a JSON Object, we only allow the keys that implement this interface.

Attributes

Companion
object
Source
JsonFieldDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
JsonFieldDecoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
JsonFieldEncoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
trait JsonFieldEncoder[-A]

When encoding a JSON Object, we only allow keys that implement this interface.

When encoding a JSON Object, we only allow keys that implement this interface.

Attributes

Companion
object
Source
JsonFieldEncoder.scala
Supertypes
class Object
trait Matchable
class Any
Self type
sealed trait JsonMemberFormat extends String => String

Attributes

Source
macros.scala
Supertypes
trait String => String
class Object
trait Matchable
class Any
Known subtypes
object CamelCase
class CustomCase
object KebabCase
object PascalCase
object SnakeCase
object KebabCase
object SnakeCase
Show all
sealed trait JsonStreamDelimiter

Attributes

Companion
object
Source
JsonStreamDelimiter.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Array
object Newline

Attributes

Companion
trait
Source
JsonStreamDelimiter.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
case object KebabCase extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
KebabCase.type
case object PascalCase extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
PascalCase.type
case object SnakeCase extends JsonMemberFormat

Attributes

Source
macros.scala
Supertypes
trait Singleton
trait Product
trait Mirror
trait Serializable
trait Product
trait Equals
trait String => String
class Object
trait Matchable
class Any
Show all
Self type
SnakeCase.type
final case class jsonAliases(alias: String, aliases: String*) extends Annotation

If used on a case class field, determines the alternative names of the JSON field.

If used on a case class field, determines the alternative names of the JSON field.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonDiscriminator(name: String) extends Annotation

If used on a sealed class, will determine the name of the field for disambiguating classes.

If used on a sealed class, will determine the name of the field for disambiguating classes.

The default is to not use a typehint field and instead have an object with a single key that is the class name.

Note that using a discriminator is less performant, uses more memory, and may be prone to DOS attacks that are impossible with the default encoding. In addition, there is slightly less type safety when using custom product encoders (which must write an unenforced object type). Only use this option if you must model an externally defined schema.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final class jsonExclude extends Annotation

If used on a case class field, will exclude it from the resulting JSON.

If used on a case class field, will exclude it from the resulting JSON.

Attributes

Source
macros.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final case class jsonExplicitEmptyCollections(encoding: Boolean = ..., decoding: Boolean = ...) extends Annotation

If used on a case class, will encode/decode empty collections explicitly.

If used on a case class, will encode/decode empty collections explicitly.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonExplicitNull() extends Annotation

If used on a case class or case class field, will encode None values as null.

If used on a case class or case class field, will encode None values as null.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonField(name: String) extends Annotation

If used on a case class field, determines the name of the JSON field. Defaults to the case class field name.

If used on a case class field, determines the name of the JSON field. Defaults to the case class field name.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonHint(name: String) extends Annotation

If used on a case class will determine the type hint value for disambiguating sealed traits. Defaults to the short type name.

If used on a case class will determine the type hint value for disambiguating sealed traits. Defaults to the short type name.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonHintNames(format: JsonMemberFormat) extends Annotation

If used on a sealed class will determine the strategy of type hint value transformation for disambiguating classes during serialization and deserialization. Same strategies are provided as for jsonMemberNames.

If used on a sealed class will determine the strategy of type hint value transformation for disambiguating classes during serialization and deserialization. Same strategies are provided as for jsonMemberNames.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final case class jsonMemberNames(format: JsonMemberFormat) extends Annotation

If used on a case class, determines the strategy of member names transformation during serialization and deserialization. Four common strategies are provided above and a custom one to support specific use cases.

If used on a case class, determines the strategy of member names transformation during serialization and deserialization. Four common strategies are provided above and a custom one to support specific use cases.

Attributes

Source
macros.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Annotation
class Object
trait Matchable
class Any
Show all
final class jsonNoExtraFields extends Annotation

If used on a case class, will exit early if any fields are in the JSON that do not correspond to field names in the case class.

If used on a case class, will exit early if any fields are in the JSON that do not correspond to field names in the case class.

This adds extra protections against a DOS attacks but means that changes in the schema will result in a hard error rather than silently ignoring those fields.

Cannot be combined with @jsonDiscriminator since it is considered an extra field from the perspective of the case class.

Attributes

Source
macros.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
object ziojson_03

zio-json version 0.3.0 formats. abc123Def -> abc_123_def

zio-json version 0.3.0 formats. abc123Def -> abc_123_def

Attributes

Source
macros.scala
Supertypes
class Object
trait Matchable
class Any
Self type
ziojson_03.type

Value members

Inherited methods

def readJsonAs(url: URL): ZStream[Any, Throwable, Json]
def readJsonLinesAs[A : JsonDecoder](url: URL): ZStream[Any, Throwable, A]
def writeJsonLines[R](path: String, stream: ZStream[R, Throwable, Json]): RIO[R, Unit]
def writeJsonLinesAs[R, A : JsonEncoder](path: String, stream: ZStream[R, Throwable, A]): RIO[R, Unit]

Implicits

Implicits

final implicit def DecoderByteArrayOps(json: Array[Byte]): DecoderByteArrayOps

Attributes

Source
package.scala
final implicit def DecoderBytesOps(json: Chunk[Byte]): DecoderBytesOps

Attributes

Source
package.scala
final implicit def DecoderOps(json: CharSequence): DecoderOps

Attributes

Source
package.scala
final implicit def EncoderOps[A](a: A): EncoderOps[A]

Attributes

Source
package.scala