What Is JSON?


Furqan Butt

Software Developer

What Is JSON?

In this article, you'll learn all about JSON and its benefits, especially when it comes to performing data analytics.

Table of Contents

what-is-jsonWhat Is JSON?

JavaScript Object Notation, more commonly referred to as JSON, is a universal data format for sharing data between different software applications. JSON has revolutionized the database industry over time, as evidenced by the use of JSON as the underlying data storage format in NoSQL databases, like SingleStore.

In this article, you'll learn more about JSON and why it's such a popular data format. You'll take a look at some of its benefits and learn how analytics can be performed on JSON data structures.

As mentioned previously, JSON is considered a universal data exchange format, which means it's used everywhere for everything. However, this was not always the case. It was originally designed as a communication channel between JavaScript-based frontend clients and backend servers.

However, because JSON is concise, readable, lightweight, and highly flexible, the software community began to see its practical applications in other areas. Because it's a text-based format, it's easy for both humans and machines to read. And with the explosion in popularity of JavaScript-based frameworks, such as Express, React and Node.js — and because JSON is natively supported within these frameworks — it quickly became the most popular data format choice.

jso-ns-structureJSON's Structure

The structure of a JSON record is very straightforward: there is an object denoted with {} and properties/attributes represented by key-value pairs, { key : value}.

For instance, in the following code, a "person" object is defined in JSON:

    "name": "John",
    "age": 25

The {} denotes the boundaries of the "person" object. Within the confines of the curly braces are the properties or attributes of the object. Key-value pairs represent one property of the object separated via a column; in this case, name is the key, and John is the value. Similarly, age is another key, for which 25 is the value.

You can represent any real-life object having any number of attributes with this simple structure. Some other rules for the JSON data format include the following:

  • Different properties are separated by commas: , (*ie* {key1 : value1, key2: value2})
  • Strings are enclosed within quotes: "" (*ie* { key : "abcd" })
  • Arrays are represented with [] (*ie* { key: [1,2,3,4, "a", "s", "d", "f"] })

JSON supports all major data types, which include strings, numbers, arrays, Boolean, objects and null, and the nested objects are presented like this: { key : { k : v } }.

how-json-differs-from-other-data-structuresHow JSON Differs from Other Data Structures

For communication and data exchange between frontends and backends, different data formats have been created over the years. These include CSV, XML, YAML, binary files, Apache Parquet and Apache Avro.

In the following sections, you'll compare JSON with other data formats to see how they differ.

JSON vs. Binary Data

As previously stated, JSON is a text-based format that is both human- and machine-readable. In contrast, binary data is only machine-readable. This makes it almost impossible for a human to work with it while programming software.


Before JSON became widely popular, the XML format was the de facto format used to exchange data between systems. If you use the same person object in XML, you'll have the following structure:


If you compare JSON and XML formats, you'll find that JSON is more readable than XML due to the arrangement of elements within both data formats. In addition, as you define complex objects with hundreds of attributes, it becomes a challenge not only to understand the structure but to design a system for parsing the data from XML.


The CSV format is a great option for storing large sets of data in tabular formats. However, unlike JSON, CSV records have little to no structure, which is not ideal for defining complex objects.

For instance, the same person object in CSV would look like this:

name, age
John, 25

The first row, also called the header row, represents the name for each attribute (commonly referred to as columns). Subsequent rows represent the data for each attribute. CSV format fails to cater to a large number of complex objects, and the structure starts breaking when objects have a variable number of attributes and data types. Say for example you have a JSON record like this:

    "key1" : "val1",
    "key2" : "val2",
    "key3" : [1,2,3,4,5],
    "key4" : [
                       "k1": "v1",
                       "k2" : "v2"
                       "k3": "v3",
                       "k4" : "v4"

Storing the preceding record in CSV format would look like this:

key1, key2, key3, key4
"val1", "val2",[1,2,3,4,5], [{"k1":"v1", "k2":"v2" },{"k3":"v3","k4":"v4"}]

As you can see, this isn't the best way to store complex objects.


In terms of formatting options, YAML is the most similar to JSON since they have very similar structures. In fact, YAML is a superset of JSON, making it possible for parsing JSON data with a YAML parser.

YAML records are more concise compared to the same JSON record and have a hierarchical structure based on indentation instead of curly braces. This makes it a suitable choice for a data exchange format. For example, the person object in YAML would look like this:

    name: John
    age: 25

The most popular application of YAML is for defining configuration files. Although the YAML format is gaining traction with applications currently, JSON remains more popular since it's already an established data exchange format.

benefits-of-jsonBenefits of JSON

Working with JSON is easy. Some of its most striking features include the following:

  • Compact and easy to read. JSON is text-based, so it's easy for humans to read — and with a proper structure, it's easily parsed by machines.
  • Key-value pair approach. The key-value approach in JSON is much easier to work with because each value corresponds to one key in the object. This also makes it much more efficient programmatically because, with a known key, data access is in constant time (big O(1)).
  • Support for a wide range of data types. One of JSON's primary features is its flexibility in supporting different data types within the same object. A JSON object can have text, numbers, floats, arrays and nested JSON objects within the same structure, which can all be easily accessed, updated and removed. JSON can also provide levels of nesting records and even support object graphs and circular references.
  • Widely supported. The developer community for JSON is very large. It's a de facto data format for all new systems, for all types of applications, processes and communication among systems.

json-use-casesJSON Use Cases

As previously discussed, JSON is used for all types of use cases. The following are some of the most common:

  • Programming languages. Even though JSON stands for JavaScript Object Notation, it's actually language-independent. All popular languages provide JSON parsers to work with JSON data.
  • Web services and REST APIs. If you've ever worked with a REST API or web service, you know that the request body and the response returned by the API are in JSON format.
  • System configuration files. JSON can define configuration files in certain instances, including when providing credentials for a user or initial startup parameters for an application.
  • Infrastructure as a Service (IaaS). In the case of IaaS, the entire infrastructure can be concisely defined as a JSON document and submitted for deployment. JSON also enables version control over the infrastructure, and any changes to the infrastructure can be easily tracked and managed using a version control system such as Git.
  • JSON Web Tokens (JWT). JSON is used for JWT secure data transmission between two parties.
  • Document data stores. Document data stores or databases are among the more recent applications of the JSON format, advocating the shift toward NoSQL databases, many of which are JSON based. MongoDB is a popular document database and an integral part of the MERN or MEAN stack technologies.

json-document-database-and-how-they-work JSON Document Database and How They Work

A JSON document database is a NoSQL database that has been designed to store and retrieve data as JSON records (i.e. JSON documents). With a JSON document database, you can store and retrieve data in JSON; however, like traditional SQL or relational databases, you get support for all standard SQL data types and indexing, connectivity and querying features.

JSON document databases are widely popular because of the flexibility they offer to store and retrieve data in a semi-structured manner (e.g. JSON). In comparison, traditional SQL databases have to adhere to a fixed schema for storing data.

In addition, with JSON document databases, developers can work with data in the same format their application code is in. This means they're ideal for rapidly evolving products or systems that don't adhere to a fixed schema. Ultimately, they help increase the development speed as compared to SQL or relational databases for which careful schema designing is required.

JSON document databases also have wide applications, or in other words, they can be used as a data store for IoT systems, which have millions of random inserts and retrievals data, click streams, monitoring and logging data, and sensory data.

benefits-of-json-document-databasesBenefits of JSON Document Databases

JSON document databases have numerous benefits, including the following:

  • Flexibility. One of the most striking features of a JSON document database is its flexibility. Since these databases are based on JSON, a semi-structured data format, they can work with a wide variety of data types and require no upfront schema design. This means it can be used for various types of applications, such as content management applications and data cataloging services.
  • Easy migrations. Because there's no schema to manage and everything adheres to the JSON structure, moving data between systems is relatively easy and typically only requires a JSON parser.
  • Low-code and rapid development. Overall, the developer community is fairly familiar with JSON data, and since there's no schema to design or manage, developers can focus on implementing the core business logic rather than spending time managing databases or writing and optimizing SQL queries. As a result, products can be developed rapidly.
  • No schema evolution challenges. Since there's no rigid schema involved that data has to adhere to, changes that occur in data over time can be easily incorporated within the system.
  • Diverse data storage. All JSON data types are natively supported, which means you can store any type of data.
  • Highly scalable. In a cloud environment, a document database can be configured in a completely serverless manner. This enables exceptional scalability and delivers elevated levels of availability.

performing-analytics-on-json-document-databasesPerforming Analytics on JSON Document Databases

As with any form of data, the ability to perform analytics and derive insights is important. With JSON data, it's common to use traditional SQL databases to store and perform analytics. However, these databases aren't designed for analytics and especially don't work well with semi-structured data, such as JSON, because they are required to have a fixed and well-defined schema.

For instance, if you try to perform analytics on JSON data using an SQL database, you'll most likely experience the following issues:

  • Complex infrastructure requirements. Because SQL databases aren't designed for JSON data, you have to design a complex infrastructure that can appropriately scale up or down to handle the analytical workloads. This is particularly important when working with operational data due to its rapidly changing nature or when performing analytics in real time.
  • Development of complex extract, transform, load (ETL). Since JSON is not natively supported, data needs to be subjected to ETL processes to transform it into a more suitable format (*ie* transforming JSON to SQL tables and then loading it into the SQL database, which can then be used in analytical jobs).
  • Problems storing a variety of data. Data conforming to a specific schema restricts what can and cannot be stored in a database. For big data analytics, the data from heterogeneous sources vary widely and, in most cases, cannot conform to one format or schema. This limits the spectrum of different types of data that can be stored.
  • Inability to perform real-time analytics. Most of the time, data is analyzed using batch processes, resulting in delayed rather than real-time analytics.
  • Schema evolution challenges. The structure of data changes over time, and with rapidly changing data, the structure becomes an even greater concern. The structure then needs to be managed so that you can use the data for practical purposes. This becomes a big challenge for SQL-based analytical systems that conform to a fixed schema.

Due to these aforementioned issues, a better approach would be to use JSON document databases for performing analytics. While they may not be the best data store, JSON document databases have proven to perform exceptionally well for analytics, especially for real-time and rapidly changing data.

For instance, JSON document databases reduce infrastructure complexity and can easily scale both vertically and horizontally as the workload increases or decreases. Moreover, with a serverless configuration, there is hardly any infrastructure or governance required.

In addition, the data from real-time systems is delivered in JSON, which can be naturally processed by a JSON document database. They're also flexible and natively supported, which means you can easily make changes in the schema and can store all types of data due to their flexible nature.

Because JSON is native to the database, complex ETL processes aren't needed and insights can be generated in real time.

As you can see, there are a lot of benefits to using JSON-based document databases. JSON has proven to be great for a wide variety of data, different types of platforms and all kinds of use cases — whether it be for storing data or performing analytics on the data.


In this article, you learned all about JSON and why it's one of the most popular data exchange formats. In addition, you learned about the benefits of JSON document databases, especially when it comes to performing data analytics.

If you want to power your modern data-intensive applications with a solution that can handle both operational workloads and data analytics, you should check out SingleStoreDB. It's based on a distributed SQL architecture that can deliver tens of milliseconds of performance and work for both operational and analytical workloads within the same engine. It works exceptionally well with JSON-intensive applications and provides performance at scale.

Interested in powering real-time JSON workloads? Get started with SingleStore today.