jsonizer
jsonizer copied to clipboard
Add default serialization / deserialization for std.variant
Given that Variant is a close mirror to JSONValue, we should be able to serialize and deserialize against a Variant.
I'm hesitant to special-case any non-builtin type. What's your use case?
I understand the hesitation. I wouldn't suggest it if it wasn't part of the standard library. For what I'm interested in, it serves as a library-agnostic serde of an unspecified type. If I want some sort of cross-compatibility between different serde formats, being able to target Variant is useful. If I was only targeting jsonizer
, I would be able to leave the type as JSONValue
, but that doesn't work if I also want to serde against MsgPack, as an example.
The alternative is support for void*, which would be very bad.