Target: Assuming we want to deserialize some JSON dynamically and we want
to unmarshal some fields using specific unmarshaling code (a
certain UnmarshalJSON). The problem is using something like
map[string]interface{} there is no way to specify that.
Thought Experiment: I like to have something like:
ourUnmarshaler.AddField("name", func() json.Unmarshaler /* default field
creator for unmarshaling */, /* other options like omitempty */)
or perhaps possibility of using:
map[string]struct{
Name string
Constructor func() json.Unmarshaler
OmitEmpty bool
String bool
// ...
}
That would be the ideal thing. But is it possible to do so with current
builtin tools? Or some package?
Other notes:
I've found gabs <https://github.com/Jeffail/gabs> but it does not what I
want. Some of my specific cases are big int64 values which should
serialized as string because they get converted to ugly float things and
some custom parsing for specific strings.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.