4 ms·
I found the EcmaScript specification[1]: > In the case where there are duplicate name Strings within an object, lexically preceding values for the same key sha
by rektide 4y ago
I found the EcmaScript specification[1]:
> In the case where there are duplicate name Strings within an object, lexically preceding values for the same key shall be overwritten.
So in JavaScript, it indeed will always work. But yes, other languages & libraries are under no obligation to follow this behavior. As you clearly show, the JSON spec itself highlights it's displeasure with & the unpredictability of duplicate keys, while also noting the two prevailing behaviors: accept last, or fail.
[1] https://262.ecma-international.org/12.0/#sec-internalizejsonproperty https://262.ecma-international.org/12.0/#sec-internalizejson...
- dmitriid 4y agoThere are at least seven different JSON specifications. And no, the ecmascript one isn't the "canonical" one. More details if you ever wanted them, here: https://seriot.ch/projects/parsing_json.html https://seriot.ch/projects/parsing_json.html
- rektide 4y agoPlease stop trolling my threads to piss on my statememts. You're being awful to me? I dont think I implied at all that kson was canonical nor absolute. I think I agreed thay it was unclear .