How knowing JSON advances your career

How knowing JSON advances your career hero

As people start out in their development careers, whether its web development, software engineering, or other aspects of coding, there is one skill that a developer should know and understand that will help advance them to the next level. While it may be considered as a "simple" skill, the simple fact that it's used in almost every aspect of development only helps to indicate how proper understanding and knowledge on how to utilize it benefits any developers career. The skill that I'm talking about is:

Knowing how to read and write JSON.

JavaScript Object Notation, or JSON for short, is a standard text-based format for representing structured data based on JavaScript object syntax. Essentially, it's a file for holding data that is set to a certain schema. It's commonly used in API's, map functionality, lists, and a number of other things. Knowing how to read JSON, as well as how to write it, will give you the skills to advance your career by laying down a foundation of what most programming languages and browsers ingest do display or collect data.

So how do we ready it? Why was it created? Question after question after question, I find that the best to approach the topic of this article is to ask general, simple questions. Who, what, when, where, why, and how?

Who invented JSON?

According to Wikipedia, podcast Hackernoon, and magazine We Are Developers, JSON was invented back in 2001 by a man named Douglas Crockford. Using technologies such as Flash and Java, Mr. Crockford opted to use a minimal approach for what was standard at the time, XML. This was born out a need to create server-to-client communications, during a time of developing what we would call a Single Page Application (SPA) today. Borrowing from the JavaScript Subset, as well as using the JavaScript compiler to parse the JSON data, Mr. Crockford opted for a minimal approach in creating this new form of communication.

What is JSON?

JSON, as it's name designates, is a collection of "objects" that hold various pieces of data. How that data is categorized and displayed is up to the developer. Compared to it's predecessor, XML, JSON is lightweight in it's approach as there are less characters in the file to process. My personal way to describe it, especially to those who are new or don't understand web development, is that JSON is a group of data that defines what the object is. The best way to describe JSON objects, it to describe how we have a certain object that most of us carry around everyday: our cellphone

{

"type": "Android",

"color": "silver",

"manufacturer": "Samsung",

"model": "S22i"

}

This would be a basic object, and example of what JSON is.

When is JSON used?

Though it varies on the application, developer preferences, and business decisions, some could say, "it depends." If you're looking at it from a higher level, JSON is used every second of every day. Anytime Instagram is being used, JSON is used to help display posts, as well as used to get information for a user and save a new post. Anytime a YouTube video is shown, the data used to get and display the video, comments, channel details, description, etc. all comes from a JSON formatted request. The data for this blog post and most of this site is done with JSON. Doing a search for a location on Google Maps uses geoJSON to not only get the coordinates of the location in longitude and latitude, but to also add a title to the pin (should it be available) of the business or address, as well as what's nearby or directions your should take to get to said location. JSON, as a file format and data schema, is used all the time.

Where is JSON stored?

That one is a little more nuanced, as it comes back to the previous questions semi-answer of, "it depends." Sometimes JSON isn't necessarily "stored", as it is applied as a means to either get or send data. This is most commonly done through an API, or Application Programming Interface. This is where we would refer to it more as a schema, or a set of rules on how to format the data so it can get ingested by the other side. In this case, JSON would be stored temporarily, as either a session or a rendered web link. JSON can be saved as it's own file format as well. Some web links can result with the ending being in a .json file extension. This can be somewhat deceptive, however, as it can either be a file that lives on the server, or it can generate through a web request. Finally, JSON can be saved in a database. The jury is out on whether this is considered to be best practices or not, but this also falls under the age old category of, "it depends." Some pre-build Content Management Systems (CMS) like WordPress utilize this strategy. While the debate on where to store your JSON is most likely going to be up for debate, the only true condition to answer is, "can you access and parse the data properly?"

Why is JSON preferred?

Speed. Speed, efficiency, and readability are the strengths of JSON. Compared to it's predecessor, XML, there is much less that needs to be written when it comes to writing or retrieving the data. To reference our example earlier with our cellphone object and how we described it, the difference on how we would do this in XML vs JSON is as such:

XML:

<manufacturer>Samsung</manufacturer>

JSON:

"manufacturer": "Samsung",

The more characters that a file or piece of data has, the longer it will take to process and send. Simply removing the less-than and greater-than symbols for quotes, adding a colon (:), and removing the closing tag for a comma (,), saves bytes and bytes of data that can really add up.

In the end, less bytes = great speed of getting the data.

How can I read JSON?

JSON, for the part, can be broken down into 3 different items to make it read easily:

  • Field definitions
    • "manufacturer": "Samsung"
  • Object(s)
    • Anything between curly brackets: { anything }
  • Arrays
    • Anything between square brackets: ["anything", "everything", "all at once"]

Additionally, JSON needs to achieve 2 things for it to be considered "good" JSON:

  • The JSON must be Well Formed
    • Uses proper naming conventions, data types, and separators
  • It must be Valid JSON
    • Follows the JSON syntax

Online tooling has made this easier to achieve, using tools such as JSONLint to look at your JSON and see if it's Valid. Being Well-Formed is going to be more on you, as a developer, to ensure that the fields make sense.

JSON uses a key : value pair system. As shown in our example earlier, manufacturer would be considered as our "key", while Samsung would be our "value".

A key can be named anything, as long as it's inside of double quotes ("). It can also contain the special characters of hyphen (-), underscore (_) or numbers. The characters can also be either uppercase or lowercase. As for what standard should be used in naming your keys, that is a inner-departmental discussion that should be had, as well as documented for any API to be created or used. Personally, I prefer to use one of the following standards:

  • Camel Case naming
    • Example: myNewKey
  • Snake Case naming
    • Example: my_new_key

I prefer either of these naming conventions due to how they are read by JavaScript or PHP. While using hyphens is an acceptable practice for generating JSON, it requires additional work and consideration in referencing the fields in these languages.

Value has a few options on what you can put in for it. Your value can be any of the following:

  • Strings (most popular)
  • Numbers
  • Boolean values (true/false)
  • Objects
  • Arrays

Having another object be a value for a key is one of the more powerful aspects of JSON. Think about it as taking something like your cellphone, and talking about the features of the cellphone. In a way, it's like categorizing the object, adding more minute details to describe what the object is about. If we continue with our example from earlier, than we can extend the object to be like so:

{

"type": "Android",

"color": "silver",

"manufacturer": "Samsung",

"model": "S22i"

"features": {

"resolution": "2340 x 1080",

"color_depth": "16M",

"wifi": "802.11 a/b/g/n/ac/ax 2.4G + 5GHz",

"bluetooth": "v5.2",

"dimensions_in_mm": "146.0 x 70.6 x 7.6",

"weight_in_grams": 167,

"has_wifi_direct": true,

"storage_gb": 128

}

}

One thing to note with each of the key : value pairs, except the last one, is that they end with a comma. This is the separator for each of the key : value pairs. Typically, if this was information being requested from an API or web service, the above code would be harder to read as it would be on one line. It would then looks like this:

{"type":"Android","color":"silver","manufacturer":"Samsung","model":"S22i","features":{"resolution":"2340 x 1080","color_depth":"16M","wifi":"802.11 a/b/g/n/ac/ax 2.4G + 5GHz","bluetooth":"v5.2","dimensions_in_mm":"146.0 x 70.6 x 7.6","weight_in_grams":167,"has_wifi_direct":true,"storage_gb":128}}

Again, this is done for speed. Even a "space" or "tab" when typed is considered to be a character that will need to be formatted and stored in the file. The more that can be minimized, the faster and more portable the data can be delivered.

Conclusion

To sum it all up, since there are so many services, applications, and businesses used on a daily basis, there is a need to read and understand JSON. If you're new to development, you might not get exposed to it until a little later in your career, but having a good foundational understanding of it can put you ahead of the competition. Additionally, being able to write JSON for the needs of your business or project will also elevate your standing in the community. Understanding how to structure your data, where to place your key : value pairs, and provide a proper naming structure to your keys can make the next developer who needs to work on the same project later sing your praise. All it takes is a little time, a bit of failure, and a little patience to become a quick expert in using JSON.

Published Monday, March 17, 2025