Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

JSON5 is okay, but it has different goals than JSON. I'm not sure if it should replace it.


Serialization vs configuration?

Isn't json a subset of json5? If so, but write out to json when serializing, but always read json5 so you never run into any surprise? Any drawback with this approach?


I think the issue is that JSON is already harder to parse than you'd think; see: seriot.ch/parsing_json.php

While JSON5 doesn't introduce huge changes as such, it does make it more complex. There is also the matter of semantics/API; should json.parse() accept JSON, JSON5, or both? What if we expect JSON and someone sends JSON5; should we accept that? Postel's law says yes, but personally I think that would be a mistake.

It seems to me that it's easier to maintain a clear distinction between the two (json.parse(), json5.parse(), etc.) One of the values of JSON as a data interchange format is that it's fairly simple, and adding JSON5 features – none of which are needed for this usage – probably isn't a good idea.

Also note that there are many JSON supersets. YAML is a JSON superset: any valid JSON is also valid YAML, there's alos HOCON, and probably a few other things as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: