Open
Description
I'm trying to decode a JSON field that can have values of Int
or String
. Unfortunately I don't have a way to change the serialization. Following the docs it looks like the approach for things like this is creating a sum type and then using variants to decode/encode.
However, I've been having trouble getting the right result. I've tried using variantMatch
and variantCase
, but both expect a tagged object.
Here is a minimally reproducible example using variantCase
. What is the best approach to handle JSON fields with mixed value types?
Thanks!