Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 Salih Dincer <salihdb@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |salihdb@hotmail.com --- Comment #1 from Salih Dincer <salihdb@hotmail.com> --- Probably, but the 2nd object with the same name is overwritten with the 1st. In summary, data points to a single object. NodeJS has the same effect: const jsonStr ='{"name":"Salih","age":42,"name":"SALIH"}'; const data = JSON.parse(jsonStr); var assert = require('assert'); assert(data.name != "Salih"); -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com --- Comment #2 from Basile-z <b2.temp@gmx.com> --- the spec quoted is clearly only about syntax, not about semantics of conflicted keys. off-topic but yaml is better on that aspect. -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |All OS|Windows |All Severity|enhancement |normal -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 --- Comment #3 from Răzvan Ștefănescu <rumbu@rumbu.ro> --- (In reply to Salih Dincer from comment #1) > Probably, but the 2nd object with the same name is overwritten with the 1st. In summary, data points to a single object. > > NodeJS has the same effect: > > const jsonStr ='{"name":"Salih","age":42,"name":"SALIH"}'; > const data = JSON.parse(jsonStr); > > var assert = require('assert'); > assert(data.name != "Salih"); I don't expect anything else from JavaScript :) I would never post this if I didn't encounter such json in the wild. Initially I had the same reaction, but the client providing that json stream pointed me to the ECMA standard and I lost all my arguments. I know that in the corresponding RFC says that you SHOULD not have duplicate keys, but SHOULD is interpreted by some people as "CAN". There are npm packages even for node.js which can handle duplicate keys. The ideea is that as long as duplicate keys are allowed in the standard, at least std.json can provide in the documentation that last value wins (there are other approaches - first value wins, error, silently transform duplicate keys in arrays). -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 anonymous4 <dfj1esp02@sneakemail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|phobos |dlang.org --- Comment #4 from anonymous4 <dfj1esp02@sneakemail.com> --- A documentation issue, right? -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 --- Comment #5 from Răzvan Ștefănescu <rumbu@rumbu.ro> --- (In reply to anonymous4 from comment #4) > A documentation issue, right? Yes, if we assume that std.json is not ECMA compliant. I don't understand why stdx.data.json didn't replace already the old std.json. It can handle also my case of duplicate keys since the parser is public. -- |
December 20, 2021 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 --- Comment #6 from Salih Dincer <salihdb@hotmail.com> --- > ... at least std.json can > provide in the documentation > that last value wins ... You're right... -- |
December 17, 2022 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 15 [Issue 22612] std.json doesn't parse duplicate keys | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22612 --- Comment #7 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dlang.org/issues/3992 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation