[Issue 22612] New: std.json doesn't parse duplicate keys

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 20 07:07:00 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22612

          Issue ID: 22612
           Summary: std.json doesn't parse duplicate keys
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: rumbu at rumbu.ro

auto j = parseJSON(`{ "key": 1, "key" : 2 }`);
writeln(j); //outputs only {"key":2}

Of course, j["key"] contains 2, value 1 gets lost in translation.

According to ECMA-404:

"The JSON syntax does not impose any restrictions on the strings used as names,
does not require that name strings be unique, and does not assign any
significance to the ordering of name/value pairs"

--


More information about the Digitalmars-d-bugs mailing list