Bug 17693 – std.json cannot parse dub.json package files

Status
RESOLVED
Resolution
WONTFIX
Severity
trivial
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-07-26T08:44:00Z
Last change time
2017-07-26T09:01:52Z
Assigned to
nobody
Creator
andre

Comments

Comment #0 by andre — 2017-07-26T08:44:03Z
It's only a minor issue but I want to bring this to your attention. std.json cannot parse several dub.json files as the json implementation of dub allows trailing commas. std.json will fail to parse these package definitions. I noticed this (annoying) issue while writing an own dub registry server.
Comment #1 by dlang-bugzilla — 2017-07-26T09:01:52Z
Fairly sure the JSON spec forbids trailing commas, so accepting them would actually be violating the spec. Although we could add an option to allow parsing trailing commas, it would make much more sense to fix Dub instead. Please file this at https://github.com/dlang/dub/issues ? If you would like std.json to have an option to allow trailing commas, please file a new issue, but I think it would need to have a much stronger justification than just Dub allowing them. As a workaround, I suggest that you use the same JSON parsing library in your project that Dub uses. That should guarantee compatibility.