ffjson
ffjson copied to clipboard
Add option to unmarshal json in a strict way
I would like to add a feature to ffjson, actually I've already implemented the feature in a local fork.
When ffjson is executed with a newly introduced flag -decode-fields-strict, it generates code that errors when a field in the json is not defined in the Go type. This means that unmarshaling {"foo": 42} into type quux struct { Bar int} will fail, as "foo" is not present as a field in the struct. It does not error when a field defined in the Go type is not set in the json (validation of values can/should still be implemented by the user).
If you're interested in this feature, I could open a PR.
:+1: