Bug 15303 – std.json: consider JSON5 support

Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-08T17:10:00Z
Last change time
2017-07-21T05:14:20Z
Assigned to
nobody
Creator
dhasenan

Comments

Comment #0 by dhasenan — 2015-11-08T17:10:20Z
JSON5 is a collection of proposed extensions to JSON that make it easier to write. It includes: * support for trailing commas * unquoted object keys * comments * multiline strings * hexadecimal numbers * explicit positive signs on integers * use of single or double quotes While std.json should only *emit* vanilla JSON, it probably wouldn't break anything to accept JSON5.
Comment #1 by Marco.Leise — 2015-12-02T17:58:52Z
JSON5 is still a proposal, which means to me: subject to change and I would prefer that std.json does not silently accept it. Also the remark that "JSON5 content may not work with existing JSON parsers" is humoristic considering the proposed changes. Then there is this parallel proposal referenced on the json5 homepage: http://bolinfest.com/essays/json.html It differs in what characters are allowed in unquoted field names and adds less features. My opinion is that anyone who wants this in Phobos should make it an opt-in extension. Both because people might depend on std.json's current validation and because the format is not well established yet.
Comment #2 by dlang-bugzilla — 2017-07-21T05:14:20Z
JSON5 has received lots of criticism from the technical community: https://news.ycombinator.com/item?id=4031699 http://ilee.co.uk/json5-is-pointless-and-unimaginative/ This is probably better left to a third-party Dub package.