Open neilalexander opened 2 years ago
The first step in solving this is (in the absence of dropping canonicaljson altogether) is to make a decision on the "correct" behaviour here. We can then figure out how to roll it out.
To open discussion: it feels like the most "correct" thing to do is to simply forbid duplicate keys (in the same way that we forbid floats, or numbers greater than 2**53
). But maybe that is a PITA to implement?
Different implementations have different ideas on how to handle duplicate keys in JSON. They shouldn't appear in theory, but there's nothing to stop you from doing something like:
How this is handled varies between implementations (Go will take the last value, Swift will take the first etc).
We don't have anything in the spec that says how to handle this case appropriately.
(created from #1232)