The peculiarities of JSON

Vladimir Kiselev
2 min readOct 1, 2021

--

JSON — the bread & butter of many software developers, especially ones who do anything related to the web. Let’s talk about some of them surprising traits of it, given that the format itself is 21 years old now

Photo by Annika Thierfeld from Pexels

No comments by design — that means that there is no syntax for comments, so of course a lot of formats brought this back (like JSONC). The funny thing is the comments were removed from the original JSON standard.

Removing comments from the JSON was something that made the YAML closer to a superset of the JSON, the YAML is not something that came out many years later as many people think (*based on my observation), YAML is 20 years old already

There is no safe way of extending or redefining the JSON (it has no version, and it should not be changed no matter what)

Numbers. Despite being called JSON (JSML was the first naming attempt according to Douglas Crockford) — the JSON numbers are not the JavaScript numbers. JSON numbers are not a superset of IEE-754 and etc (you cannot encode NaN, +- Infinity that are the valid values in JavaScript and many other languages), but you can define something that is a whole or (sometimes) a rational number. For other stuff you will need to use the strings (or just close your eyes and hope for the best)

Check the JSON standard name, it’s ECMA-404 (I wonder if it’s a pun or not)

Links

JSON website https://json.org — JSON Website (JSON has a cool logo by the way)

The ECMA-404 (this 404 number seems very familiar) standard for JSON https://www.ecma-international.org/publications-and-standards/standards/ecma-404/

Douglas Crockford: The JSON Saga https://www.youtube.com/watch?v=-C-JoyNuQJs (here the JSON discoverer himself is sharing the history of the JSON and I highly recommend you to watch this, as it’s better than any Marvel movie)

--

--

Vladimir Kiselev

Opinions shared here are mine only and probably were typed in here by a cat. I never speak on anyone else’s behalf, just me