JsonDecoder

org.sigilaris.core.codec.json.JsonDecoder
See theJsonDecoder companion trait

Attributes

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

Members list

Type members

Classlikes

object configured

Configuration-bound decoder bundles.

Configuration-bound decoder bundles.

Attributes

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

Value members

Concrete methods

Summons a decoder instance for type A.

Summons a decoder instance for type A.

val stringDec = JsonDecoder[String]

Attributes

Source
JsonDecoder.scala
inline def derived[A](using m: Of[A]): JsonDecoder[A]

Derives a decoder for type A using Scala 3 mirrors.

Derives a decoder for type A using Scala 3 mirrors.

Supports both product types (case classes) and sum types (sealed traits). Enabled via derives JsonDecoder clause.

case class Point(x: Int, y: Int) derives JsonDecoder
sealed trait Color derives JsonDecoder
case object Red  extends Color
case object Blue extends Color

Attributes

Source
JsonDecoder.scala

Inherited methods

protected def mk[A](f: (JsonValue, JsonConfig) => Either[DecodeFailure, A]): JsonDecoder[A]

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
protected def typeMismatch[A](expected: String, got: JsonValue): Either[DecodeFailure, A]

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala

Givens

Inherited givens

given bigDecimalDecoder: JsonDecoder[BigDecimal]

Decodes BigDecimal from JString or JNumber depending on config.

Decodes BigDecimal from JString or JNumber depending on config.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given bigIntDecoder: JsonDecoder[BigInt]

Decodes BigInt from JString or JNumber depending on config.

Decodes BigInt from JString or JNumber depending on config.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given booleanDecoder: JsonDecoder[Boolean]

Decodes JBool to Boolean.

Decodes JBool to Boolean.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
inline given derivedProductDecoder[A](using m: ProductOf[A]): JsonDecoder[A]

Derives a decoder for product types (case classes) by decoding each field from a JObject.

Derives a decoder for product types (case classes) by decoding each field from a JObject.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
inline given derivedSumDecoder[A](using m: SumOf[A]): JsonDecoder[A]

Derives a decoder for sum types (sealed traits/enums) using wrapped-by-type-key discriminator.

Derives a decoder for sum types (sealed traits/enums) using wrapped-by-type-key discriminator.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given doubleDecoder: JsonDecoder[Double]

Decodes JNumber to Double.

Decodes JNumber to Double.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given instantDecoder: JsonDecoder[Instant]

Decodes Instant from ISO-8601 JString.

Decodes Instant from ISO-8601 JString.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given intDecoder: JsonDecoder[Int]

Decodes JNumber to Int.

Decodes JNumber to Int.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given listDecoder[A : JsonDecoder]: JsonDecoder[List[A]]

Decodes JArray to List.

Decodes JArray to List.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given longDecoder: JsonDecoder[Long]

Decodes JNumber to Long.

Decodes JNumber to Long.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given mapDecoder[K : JsonKeyCodec, V : JsonDecoder]: JsonDecoder[Map[K, V]]

Decodes JObject to Map by converting field names with JsonKeyCodec.

Decodes JObject to Map by converting field names with JsonKeyCodec.

Fails on key parse errors or duplicate decoded keys after normalization.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given optionDecoder[A : JsonDecoder]: JsonDecoder[Option[A]]

Decodes Option, treating JNull as None.

Decodes Option, treating JNull as None.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given stringDecoder: JsonDecoder[String]

Decodes JString to String.

Decodes JString to String.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala
given vectorDecoder[A : JsonDecoder]: JsonDecoder[Vector[A]]

Decodes JArray to Vector.

Decodes JArray to Vector.

Attributes

Inherited from:
JsonDecoderInstances
Source
JsonDecoder.scala