package json
- Alphabetic
- By Inheritance
- json
- JsonPackagePlatformSpecific
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- implicit final class DecoderOps extends AnyVal
- implicit final class EncoderOps[A] extends AnyVal
- final case class JsonCodec[A](encoder: JsonEncoder[A], decoder: JsonDecoder[A]) extends Product with Serializable
A
JsonCodec[A]
instance has the ability to encode values of typeA
into JSON, together with the ability to decode such JSON into values of typeA
.A
JsonCodec[A]
instance has the ability to encode values of typeA
into JSON, together with the ability to decode such JSON into values of typeA
.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) }}
- trait JsonCodecVersionSpecific extends AnyRef
- trait JsonDecoder[A] extends JsonDecoderPlatformSpecific[A]
A
JsonDecoder[A]
instance has the ability to decode JSON to values of typeA
, potentially failing with an error if the JSON content does not encode a value of the given type. - trait JsonDecoderPlatformSpecific[A] extends AnyRef
- trait JsonDecoderVersionSpecific extends AnyRef
- sealed abstract class JsonDeriveConfig extends AnyRef
Define a config for derivation macro
- trait JsonEncoder[A] extends JsonEncoderPlatformSpecific[A]
- trait JsonEncoderPlatformSpecific[A] extends AnyRef
- trait JsonEncoderVersionSpecific extends AnyRef
- sealed abstract class JsonError extends AnyRef
A
JsonError
value describes the ways in which decoding could fail.A
JsonError
value describes the ways in which decoding could fail. This structure is used to facilitate human-readable error messages during decoding failures. - trait JsonFieldDecoder[+A] extends AnyRef
When decoding a JSON Object, we only allow the keys that implement this interface.
- trait JsonFieldEncoder[-A] extends AnyRef
When encoding a JSON Object, we only allow keys that implement this interface.
- sealed trait JsonStreamDelimiter extends AnyRef
- class jsonDerive extends Annotation with StaticAnnotation
- final case class jsonDiscriminator(name: String) extends Annotation with Product with Serializable
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.
- final class jsonExclude extends Annotation
If used on a case class field, will exclude it from the resulting JSON.
- final case class jsonField(name: String) extends Annotation with Product with Serializable
If used on a case class field, determines the name of the JSON field.
If used on a case class field, determines the name of the JSON field. Defaults to the case class field name.
- final case class jsonHint(name: String) extends Annotation with Product with Serializable
If used on a case class will determine the type hint value for disambiguating sealed traits.
If used on a case class will determine the type hint value for disambiguating sealed traits. Defaults to the short type name.
- 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.
Value Members
- def readJsonAs(url: URL): ZStream[Any, Throwable, Json]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonAs(path: String): ZStream[Any, Throwable, Json]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonAs(path: Path): ZStream[Any, Throwable, Json]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonAs(file: File): ZStream[Any, Throwable, Json]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonLinesAs[A](url: URL)(implicit arg0: JsonDecoder[A]): ZStream[Any, Throwable, A]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonLinesAs[A](path: String)(implicit arg0: JsonDecoder[A]): ZStream[Any, Throwable, A]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonLinesAs[A](path: Path)(implicit arg0: JsonDecoder[A]): ZStream[Any, Throwable, A]
- Definition Classes
- JsonPackagePlatformSpecific
- def readJsonLinesAs[A](file: File)(implicit arg0: JsonDecoder[A]): ZStream[Any, Throwable, A]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLines[R](path: String, stream: ZStream[R, Throwable, Json]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLines[R](path: Path, stream: ZStream[R, Throwable, Json]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLines[R](file: File, stream: ZStream[R, Throwable, Json]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLinesAs[R, A](path: String, stream: ZStream[R, Throwable, A])(implicit arg0: JsonEncoder[A]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLinesAs[R, A](path: Path, stream: ZStream[R, Throwable, A])(implicit arg0: JsonEncoder[A]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- def writeJsonLinesAs[R, A](file: File, stream: ZStream[R, Throwable, A])(implicit arg0: JsonEncoder[A]): RIO[R, Unit]
- Definition Classes
- JsonPackagePlatformSpecific
- case object BuildInfo extends Product with Serializable
This object was generated by sbt-buildinfo.
- object DeriveJsonCodec
- object DeriveJsonDecoder
- object DeriveJsonEncoder
- object JsonCodec extends GeneratedTupleCodecs with CodecLowPriority0 with JsonCodecVersionSpecific with Serializable
- object JsonDecoder extends GeneratedTupleDecoders with DecoderLowPriority1 with JsonDecoderVersionSpecific
- object JsonDeriveConfig
- object JsonEncoder extends GeneratedTupleEncoders with EncoderLowPriority1 with JsonEncoderVersionSpecific
- object JsonError
- object JsonFieldDecoder
- object JsonFieldEncoder
- object JsonStreamDelimiter