Re:Decoding JSON sum types in Go without panicking
by 0x696C6961 on Wednesday March 19, 2025 @06:25PM
(#43417887)
Last time I checked, the json/v2 package fixed the double decode problem by passing the decoder into the unmarshaling callback.
[ Parent
| on HN ]
Re:Decoding JSON sum types in Go without panicking
by shabbyrobe on Wednesday March 19, 2025 @06:39PM
(#43417990)
That's not what I found in my own experiments, I still had to unmarshal once inside the callback to get the `type` field out, then again once I knew what the type was. Do you have an example handy?