JSON5 support for std.json
Jonathan M Davis via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 29 17:02:37 PST 2015
On Monday, 30 November 2015 at 00:30:07 UTC, Chris Wright wrote:
> I'm considering adding JSON5 support to std.json and want to
> know how well this would be received.
> format, allowing things like comments, trailing commas, and
> single-quoted strings.
> I only plan to add support for parsing JSON5, not emitting it.
> So there should be no compatibility concerns with what std.json
> Since it's technically a breaking change (people can use
> std.json currently to validate that a document is valid JSON),
> I am inclined to make JSON5 be off by default and add an option
> to parse JSON5 rather than JSON1. Anyone have strong feelings
> about this?
Having a JSON 5 parser makes some sense, but I don't think that
it makes any sense to have one which can parse JSON 5 but not
emit it. Either you're dealing with JSON 5 or you're not, and the
historical approach of the internet to be lax in what you accept
and strict what you emit has proven to be a horrible approach
So, creating a new module specifically for a new version of JSON
seems fine, or maybe it would make sense for one module to
support multiple versions by specifying which you want to use
(assuming the the APIs are pretty much the same across versions,
which they probably aren't), but let's please not have something
that mucks around with multiple versions of JSON at once.
Also, note that std.json will probably be replaced at some point
here. There's at least one replacement in the works that's had
some review in the newsgroup:
So, updating the current std.json to support other versions of
JSON probably doesn't make a lot of sense regardless of how we
want to handle multiple versions.
- Jonathan M Davis
More information about the Digitalmars-d