What is JSON: Everything to Know

6 Facts about JSON

  • According to its creator, JSON is pronounced like the name Jason. However, most people say the word by emphasizing the letter j and pronouncing “son” like the “mon” in “monster.”
  • JSON is an internationally defined standard, with definitions by two different standards organizations (ISO and ECMA).
  • The prototype for JSON was created for a virtual card game called Cartoon Orbit in early 2000.
  • JSON stands for JavaScript Object Notation but is a language-independent data format.
  • JSON files use the .json file extension.
  • JSON does not support comments.

What is JSON: Explained

JSON is a text-only format for storing and exchanging data. The format was initially created by Douglas Crockford at his company State Software in 2000 and 2001. Since that time, it has become a vastly popular format for storing data that needs to be accessed by JavaScript programs or other types of software. Its popularity is reflected in the fact that it is now defined by several international standards, including ISO/IEC 21778:2017 and RFC 8259.

At the heart of JSON’s usefulness is its extreme simplicity. Unlike XML and some other formats, JSON syntax is extremely brief and the data in a JSON object can easily be parsed into data in any number of programming applications. Essentially, all JSON objects are strings where properties are defined and then given values. In addition to strings, JSON supports numbers, other JSON objects, arrays, Booleans (see the biography of George Boole), and null values. Functions, dates, and other undefined data types are not allowed.

JSON objects can be written in any text editor and viewed in any file viewer that opens text files. Once they are saved, JSON files can be accessed by programs written in numerous languages using language-specific parsing functions to retrieve and store data.

JSON Douglas Crockford
Douglas Crockford, the creator of JSON. JSON is a text-only format for storing and exchanging data.

How to Use JSON

JSON is easy to use. First, create an empty file in your text editor of choice.

To create a valid JSON object, you only need the properties and values of the data you are representing. For this example, we’ll use data about JavaScript.

  • name: JavaScript
  • release date: 1995
  • type: language
  • creator: Brendan Eich

This data would be represented in JSON as follows:

{"name":"JavaScript","release date":"1995","type":"language","creator":"Brendan Eich"}

It’s important to note that dates are not supported by JavaScript. In the example above, the date is a string set off by quotation marks.

Although dates are not supported, not all values need to be strings. JSON objects can also store numbers, other JSON objects, arrays, and Booleans (see the biography of George Boole), as well as the value null. These data types should not be placed in quotation marks when using JSON, or they will be interpreted as strings.

Arrays are defined using square brackets and can contain any type of data supported by JSON (numbers, strings, arrays, JSON objects, Booleans, or null values). Here is an example of a JSON object with an array:

{"names":["John", "Judy", "Ping", "Akiko"]}

The method for accessing JSON files varies by programming language and environment. To determine how best to store and access them, refer to the documentation for the language you are using.

How to Learn JSON

With its wide variety of applications in many languages, learning JSON can be a good way to increase your computer programming capabilities.

Fortunately, JSON is easy to learn. The syntax is straightforward and simple, especially if you already know JavaScript. Even for those who have never needed to use objects in JavaScript (or use JavaScript at all), JSON is easy to pick up as all you really need to learn are a few simple rules.

The bulk of learning JSON is learning how to use it in your programming language of choice. Although nearly all programming languages support JSON, each has a slightly different implementation. This means that to be truly proficient in JSON you need to not only learn the format’s syntax but also how to parse it in the language that will be using the data.

There are many free JSON tutorials online and numerous books that take a deep dive into the subject. Here are a few of the best:

Video explaining the basics of JSON quickly and easily. JSON is the most popular data representation format and is one of the most important, and easiest concepts you can learn in programming. It allows you to create APIs, config files, and structured data.

JSON Release History

JSON was first released in 2001 and its syntax has not changed since then. As a data format rather than a programming language, it also has no “release history” as such. However, there are several standards that define the format and how it can be used.

RFC 4627

In 2006, the Internet Engineering Task Force (IETF), released a Request for Comments (RFC) document, RFC 4627, describing JSON’s basic capabilities, encoding, parser functionality, and security considerations.

ECMA 404

ECMA 404, released in 2013, was the first official standard defining JSON syntax.

A second edition of the ECMA 404 standard was released in December 2017.

ISO/IEC 21778:2017

Also in 2017, the International Standard Organization (ISO) and (IEC) released ISO/IEC standard 21778:2017 to define the syntax for JSON.

The Difference between JSON and YAML

JSON is only one of many different data interchange formats, including XML, RSS, and others. Another commonly used format, YAML, is especially interesting because it is so similar to JSON that all valid JSON files are also valid YAML files.

There are several significant differences between JSON and YAML, primarily based on things that are supported in YAML but not in JSON. The most important of these are listed below:

  • YAML supports comments, while JSON does not
  • JSON strings require quotation marks, while YAML strings do not
  • YAML supports mapping and anchors, while JSON does not

Although YAML has more features, JSON is still an incredibly useful format because of its streamlined nature and simplicity.

JSON (JavaScript Object Notation) – Complete history FAQs (Frequently Asked Questions) 

What is JSON?

JSON (JavaScript Object Notation) is a data-interchange format, a type of syntax used to describe data for use between different systems. Despite the JavaScript in the name, JSON is language independent and can be used by many programming languages.

When did JSON come out?

Development on JSON started in 2000. The format was first released in March 2001 and has been an international standard since 2013. The current version of JSON was released in 2017 under two international standards.

What was the original price of JSON?

JSON is not a proprietary format and is released under an open license granting permission to use it without limitations at no cost.

What does JSON stand for?

JSON stands for JavaScript Object Notation. Despite the use of the word JavaScript in its name, it’s important to remember that the data format can be used in almost any programming language.

What is object notation in JSON?

The “Object Notation” part of JSON’s name refers to the fact that it is based on the format used for defining objects in JavaScript. This phrase does not refer to a specific technique that can be used in JSON but simply describes its origins.

Is a JSON file a valid JavaScript object?

Because its syntax is derived from JavaScript object notation, a correctly formatted JSON file should always be a valid JavaScript object. If you are trying to use a JSON file in JavaScript and receive an error message, check to make sure your syntax is correct using a free online validator or formatter.

What is JSON data structure?

JSON’s data structure is straightforward. Each string contains a number of properties with a defined value.

Consider this example:

{“name”:”JavaScript”, “type”:”language”}

This object contains two properties (“name” and “type”), both of which have defined values (“JavaScript” and “language”). The single and double quotes, colons, commas, and brackets are the syntax used to clarify the data structure.

How do you open a JSON file?

JSON files can be opened in any text editing program or file viewer. On Windows, you can right-click the file and select which program you would like to use to open it. Additionally, most text editing programs will allow you to open JSON files from within the program by using the “open file” menu option.

How do you create a JSON file?

JSON files can be created in any text editing program. After writing your code, save the file and change its extension to .json instead of .txt. Note that your syntax needs to be valid for the file to work as expected.

Are there any JSON beautifiers?

There are several formatters and beautifiers. Check out JSON Formatter and JSON Beautifier. These beautifiers do not make any changes to the syntax or content of a file but simply make its data easier for humans to read. After being placed in a beautifier, JSON files should still be accessible by any text editor or viewer.

How do you use a JSON validator?

A JSON validator is a piece of software designed to make sure your code is correctly formatted. Typically, validators are web-based. You simply paste your code into a text area and click the “validate” button to see if there are errors in your formatting. Available validators include JSONLint and CodeBeautify.

Sources
  1. W3schools, Available here: https://www.w3schools.com/js/js_json_intro.asp
  2. ISO, Available here: https://www.iso.org/standard/71616.html
  3. Data TRacker, Available here: https://datatracker.ietf.org/doc/html/rfc8259
  4. ECMA International, Available here: https://www.ecma-international.org/publications-and-standards/standards/ecma-404/
  5. SQLizer, Available here: https://blog.sqlizer.io/posts/json-history/
  6. JSON, Available here: https://www.json.org/json-en.html
  7. Two-Bit History, Available here: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html