Open atz opened 3 years ago
I think that would work.
Only thing to watch out for is ambiguous values that can't be round-tripped or things that don't have an obvious JSON representation. That has been an obstacle for JSON marshalling support for some other types. But off the top of my head I don't see any issues here.
Application JSON data coming in (or going out) should not know (or reveal) anything about our underlying implementation model. For a given struct like:
Populated accordingly, it would be reasonable for
json.Marshall
to deliver bytes equivalent to (for example):Symmetrically,
json.Unmarshal
should be able reconstitute the struct from the serialized JSON. Can probably submit a PR for some of this if you concur. Currently that would give an error like: