org.sigilaris.core.codec.json.JsonCodec
See theJsonCodec companion object
Bidirectional JSON codec bundling a JsonEncoder and a JsonDecoder.
Provides convenience encode/decode that delegate to the underlying instances. When both encoder and decoder are available, a given codec is derived automatically.
'''Example:'''
case class User(name: String, age: Int) derives JsonCodec
val codec = JsonCodec[User]
val json = codec.encode(User("Alice", 30))
val user = codec.decode(json)
See also: JsonEncoder for encoding only, JsonDecoder for decoding only
Value parameters
- decoder
-
the JSON decoder for type A
- encoder
-
the JSON encoder for type A
Attributes
- Companion
- object
- Source
- JsonCodec.scala
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any
Members list
In this article