If the process decoding JSON wants to detect unsupported fields its very difficult. Either the json has to be decoded into a map[string]json.RawMessage then parse out each field into sub object, etc. But this could be codified into the decoder very easily. For example I would love to see this work:
What I would love is to be able to write this as code:
In order to work json:"*" should only be used on a map[string]interface{} or a map[string]json.RawMessage. That is the one oddity to this that I can see outright.
The text was updated successfully, but these errors were encountered:
Possibly a duplicate of #6213; see also some relevant discussion in #15314.
quentinmit
changed the title
Go's json decoder should support '*' spill over
encoding/json: Go's json decoder should support '*' spill over
Sep 12, 2016
If the process decoding JSON wants to detect unsupported fields its very difficult. Either the json has to be decoded into a map[string]json.RawMessage then parse out each field into sub object, etc. But this could be codified into the decoder very easily. For example I would love to see this work:
What I would love is to be able to write this as code:
In order to work
json:"*"
should only be used on a map[string]interface{} or a map[string]json.RawMessage. That is the one oddity to this that I can see outright.The text was updated successfully, but these errors were encountered: