JSON5 support for std.json

Jack Stouffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 30 12:42:20 PST 2015


On Monday, 30 November 2015 at 16:12:07 UTC, Chris Wright wrote:
> The reason to incorporate it into the standard library 
> interpretation is because it's mostly identical to JSON, so 
> sharing implementations is obvious.

That doesn't follow. Just because implementations are mostly 
shared doesn't mean that it should be included into Phobos. 
Someone still needs to maintain your new code and the cost 
benefit analysis still needs to happen.

> For instance, a feature request for Newtonsoft JSON.NET (which 
> is the most
> well known JSON library for .NET) to support JSON5 pretty much 
> went "What's JSON5?" and then "Oh, we already support 90% of 
> that".

So the authors of one of the most well known JSON libraries has 
also never heard of it.

> The recent thread about DUB's config format would have been 
> much more strongly
> in favor of JSON if std.json supported JSON5.

How much stronger can you get than almost everyone but like three 
people being in favor of JSON over SDL?

Again, I see no evidence that JSON5 is at all popular. I can list 
well over 2000 popular repos on Github that use JSON in some way, 
either with APIs or config files, etc. So show me at least 50 
github repos with over 500 stars that use JSON5 (meaning they are 
not JSON5 parsers) and I will change my mind. 50 is not an 
unreasonable number to ask for, as you want this to go into 
Phobos, this needs a lot of ground swell and use.

JSON5 is also just a terrible idea. There is a very good reason 
why JSON does not have comments 
https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaGSr 
and why it's strict. Data formats should have data, not anything 
else. It's bare bones structure and strictness makes standard 
following parsers extremely fast, in fact the fastest serializers 
ever. Loose data formats are a nightmare to work with, XML being 
the front runner in this regard, as parsing is slow and data can 
be stored and accessed in tons of different ways.

As I mentioned earlier, JSON5 is not JSON, it's something else. 
There is only one JSON and calling what ever this is JSON is 
disingenuous on the part of the creator. So even if this got into 
Phobos, it shouldn't go into std.json.

If you want a human readable format, just use YAML and use one of 
the many, many cross compilers of YAML to JSON.


More information about the Digitalmars-d mailing list