JSON : A Format For The People

Ryan Kendig
4 min readJan 26, 2021

--

Let’s get in our time machine and head back to the early 2000s. You just got home from school, you turn on the TV, TRL is on. Blink 182’s video for “All The Small Things” is playing and graces your ears for the first time. This is a magic moment, you must blog about it on your Xanga page. You run over to the computer and dial up the internet. After 5 minutes or so, you navigate to Internet Explorer and click login on the Xanga page — several moment go by. You see a blog you like and you decide to give it some e-Props — another several moments go by. Then you want to comment on that blog which adds several more button clicks and full page reloads — and several more moments. Every button click would require the browser to re-render the entire page, even if only a small section of the page had changed. So many moments have gone by that you’ve long forgotten how inspirational Tom DeLonge is and it’s time for dinner. The world has missed an opportunity to be graced by yet another teenage blog about Blink 182.

This was the internet when web requests were loading all the data at once. As this technology progressed, pages were loading increments of data in the background and were able to be manipulated by JavaScript. This data was transferred from server to browser in a standard format known as XML (Extensible Markup Language). This format was long-winded and not very human-readable. Here’s an example:

<person>
<first_name>Tom</first_name>
<last_name>DeLonge</last_name>
<is_guitar_player>true</is_guitar_player>
<plays_in_bands>
<in_bands>Blink 182</in_bands>
<in_bands>Angels & Airwaves</in_bands>
</plays_in_bands>
<songs>
<song>
<name>All The Small Things</name>
</song>
</songs>

</person>

You know, this kind of looks like an Object in JavaScript. Maybe someone will come along and create a format for data transfer that looks more like the programming language that’s being used universally in web browsers. Enter Douglas Crockford.

JSON wasn’t so much invented by Crockford as it was ‘discovered’ by him. Here’s a quote:

“A number of people independently discovered that JavaScript’s object literals were an ideal format for transmitting object-oriented data across the network. I made my own discovery in April of 2001 when I was CTO of State Software.”

discovery involves pointing and looking directly at the sun.

JSON is a lightweight data-interchange format built on two structures — 1) a collection of key/value pairs and 2) an ordered list of values. In JavaScript, these structures are known as Objects and Arrays respectively, but they are present in many other languages such as C#, Java, Perl, Python. Here’s a chart of values that can be used within those structures:

The universal nature of this format is it’s biggest advantage over XML. The data is stored in plain text files which are easy to open, examine, and send over the internet.

Compare the following example to the one shown above and you’ll see how concise JSON is versus its predecessor:

{
“firstName”: “Tom”,
“lastName”: “DeLonge”,
“isGuitarPlayer”: true,
“playsInBands”: [“Blink 182”, “Angels & Airwaves”],
“songs”: [
{
“name”: “All The Small Things
}
]
}

That’s just about half the keystrokes as the XML format and presented in format that a human person could understand. As hardware and software developed in the early 2000s, Single Page Applications(SPA) emerged. SPAs are websites that interact with the user by dynamically rewriting the current web page with new data via a JavaScript API such as ‘Fetch’ to display different content. This allows users to use websites without loading whole new pages from the server which improves performance and results in a more dynamic experience. This new type of web application needed a format to exchange data and function efficiently. That format was JSON.

There is plenty to love about JSON, but I’d be remiss if I didn’t mention at least one drawback to this format. While JSON is known for being easy to read and understand, you are unable to write comments in a JSON file. It is strictly data only. If you include a comment in your JSON file, it will also be treated as data. Comments decrease the likelihood of confusion when working on an existing project and allow for smoother collaboration between developers.

JSON is great connector between back-end services and web/mobile clients. No other format is as approachable, readable, and universally supported by modern programming languages. If you find yourself interviewing at a company that still uses XML as their data-interchange format, repeat the following words: “Say it ain’t so, I will not go, turn the lights off, carry me home.”

If you’re interested in hearing it from the discoverer himself, this talk at the Silicon Vally Code Camp in 2019 by Douglas Crockford is a great oral history of JSON.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ryan Kendig
Ryan Kendig

Written by Ryan Kendig

Player of guitars and games. Learning to code one curly brace at a time.

No responses yet

Write a response