RFC4627 says "The names within an object SHOULD be unique." Not
MUST. Most JSON parsers pick either the first duplicate instance, or
the last. I'm working between Rust and Erlang (via rustler) and wanted
the option to match serde_json's approach of picking the last
duplicate key in an object.
This change adds a new option duplicate_map_keys with the allowed
values first and last. first matches the current behaviour, and
is the default.
RFC4627 says "The names within an object SHOULD be unique." Not MUST. Most JSON parsers pick either the first duplicate instance, or the last. I'm working between Rust and Erlang (via rustler) and wanted the option to match serde_json's approach of picking the last duplicate key in an object.
This change adds a new option
duplicate_map_keys
with the allowed valuesfirst
andlast
.first
matches the current behaviour, and is the default.