zio-json icon indicating copy to clipboard operation
zio-json copied to clipboard

Feat-string-like-field-decoder

Open ThijsBroersen opened this issue 7 months ago • 0 comments

This PR should provide support for string-like types (T <: String) to be used as keys in json objects. The implementation reuses any applicable existing JsonDecoder, e.g. a decoder for a string-based const union.

Foo(aOrB: Map["A" | "B", Int]) derives JsonDecoder

value encoded/decoded

Foo(Map("A" -> 1, "B" -> 2))

json

{"aOrB":{"A":1,"B":2}}

ThijsBroersen avatar Jun 28 '24 20:06 ThijsBroersen