JsonCodec

org.sigilaris.core.codec.json.JsonCodec
See theJsonCodec companion class
object JsonCodec

Attributes

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

Members list

Type members

Classlikes

object configured

Configuration-bound codec bundles.

Configuration-bound codec bundles.

Attributes

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

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

inline def derived[A : Of]: JsonCodec[A]

Derived JsonCodec using Mirror, enabling derives JsonCodec.

Derived JsonCodec using Mirror, enabling derives JsonCodec.

Supports both product types (case classes) and sum types (sealed traits).

case class Point(x: Int, y: Int) derives JsonCodec
sealed trait Shape derives JsonCodec
case class Circle(radius: Double)                   extends Shape
case class Rectangle(width: Double, height: Double) extends Shape

Attributes

Source
JsonCodec.scala
def instance[A](enc: JsonEncoder[A], dec: JsonDecoder[A]): JsonCodec[A]

Builds a JsonCodec from explicit encoder and decoder.

Builds a JsonCodec from explicit encoder and decoder.

Value parameters

dec

the decoder

enc

the encoder

Attributes

Returns

a JsonCodec wrapping both

Source
JsonCodec.scala
def of[A](enc: JsonEncoder[A], dec: JsonDecoder[A]): JsonCodec[A]

Alias of instance for conciseness.

Alias of instance for conciseness.

Value parameters

dec

the decoder

enc

the encoder

Attributes

Returns

a JsonCodec wrapping both

Source
JsonCodec.scala

Givens

Givens

Automatic JsonCodec when both encoder and decoder are available.

Automatic JsonCodec when both encoder and decoder are available.

This given instance allows implicit summoning of a codec when both an encoder and decoder are in scope.

given JsonEncoder[MyType] = ...
given JsonDecoder[MyType] = ...
val codec = summon[JsonCodec[MyType]]

Attributes

Source
JsonCodec.scala