What is a JSON File: There are lots of different types of file format available for storing the different types of data.

For example – if you want to store the HTML code in File for displaying the website content. Then you have to use the .html file formats.

Similarly, there is a format called .json file format, which is used for data exchange between the Application and Server.

In this article, we are going to take a deep look into JSON, its working, its uses, and much more.

So, let’s start with the definition of JSON File.

Table of Contents

What is a JSON File

A JSON (JavaScript Object Notation) File is a simple text-based file that stores data in a structured manner following the JavaScript Object Notation Syntax.

In simple words, JSON File is a file that is used for storing text data in the form of JavaScript Objects.

If you are already familiar with JS objects, then you can easily understand the data inside the JSON File as well.

A JSON File is generally stored in a Server and is used for exchanging the data between the Server and Client Application.

However, JSON can be used for storing the data in local storage as well.

For example – there are lots of applications, like – Google Chrome, Mozilla Firefox, and many more that uses JSON to store the data in local storage in .json file format.

Now that you get a basic understanding of JSON File. It’s time to take a look at the basic syntax of the JSON File.

JSON Syntax

The basic syntax of JSON is


This pair of key/value is called Data in a JSON Object.

So, to store multiple data in a JSON object, we have to separate the key/value pair using commas.

    KEY1: VALUE1,
    KEY2: VALUE2,
    KEY3: VALUE3

So, you can see that we have stored 3 key/value pairs and separated them with commas.

From the above syntax, you can see that Curly Braces { } are used for representing the object. Similarly, Square Bracket [ ] is used for representing the Array in a JSON File.

Please note that you can use the KEY and VALUE inside the Quotation Marks ” ” based on whether you want to make KEY and VALUE a string or not.

You will understand this much better with the help of a couple of examples which we are going to discuss below.

But before that let’s take a look at the different Data Types available in JSON.

Data Types in JSON

Here is the list of all the Data Types that you can use in a JSON File:

  1. String – You can use a set of alphabets and characters in a JSON File.
  2. Number – Integer and Floating-Point Number are used in JSON File.
  3. Boolean – JSON supports Boolean Values, like – true and false.
  4. Object – JSON is heavily used for creating objects.
  5. Array – You can also use Array of all the above-discussed Data Types in JSON.
  6. Null – The null data type is used when you want to represent a null value in JSON.

JSON Example

Here are some examples which will help you in understanding JSON much better:

1. Data in a JSON Object

    "name": "Mike",
    "age": 27,
    "selected": true

As you can see from the above example that we have created an object using Curly Braces and inside it, we have “name” as a key with a string value named “Mike”.

Then after using the comma, we have created another key/value pair, where the value is of Integer type as it is not inside the Quotation Marks.

At last, we have created another key/value pair, where the value is of Boolean type.

Now, let’s have a look at another most important example of JSON where we are going to store data inside the JSON Array.

2. Data in a JSON Array

					["Python", "Java", "JavaScript", "Kotlin"]

In the above example, we are storing the String Data in a JSON Array.

Similarly, we can store other types of Data as well, like – Integer and Boolean.

3. JSON Array in JSON Object

    "student":["Alex", "John", "Kelvin"]

In the above example, we have stored the JSON Array as a Value in a JSON key/value pair.

4. Nested JSON Object

    "Name": "Martin",
    "Details": {
        "Profession": "Doctor",
        "Age": 34

Here we have used a JSON Object inside another JSON Object.

5. Nested JSON Array

    ["First", "Second", "Third"],
    ["Fourth", "Fifth", "Sixth"],
    ["Seventh", "Eighth", "Nineth"]

In the above example, we have stored the JSON Array inside another JSON Array.

Now. let’s take an overview on opening a JSON File.

How to open a JSON File

Since JSON is a simple text file. So, you can open a .json file in any text editor.

So, doesn’t matter which Operating System or device you are using. You can easily open the .json file in it very easily.

Some of the tools that you can use for opening a JSON File are

  1. For Windows: Microsoft Notepad, Microsoft WordPad, Visual Studio Code.
  2. For Linux: Vim, GitHub Atom.
  3. For Apple: Apple TextEdit, MacVim.
  4. For Android: File Viewer for Android

Besides this, you can open a .json file using a Web Browser, like – Mozilla Firefox and Google Chrome as well.

Advantages of JSON

Here are the 2 main advantages of using JSON:

1. Easy and Fast – JSON has a very easy to read and understand code syntax. It is also very fast on the Server Side. Due to this, JSON is becoming more and more popular among developers.

2. Wide Support – JSON is supported by mostly all the Browsers, Operating Systems, and devices. So, you will not find any issue regarding the support of JSON on any device or Platform.

Disadvantages of JSON

Here are the 2 main disadvantages of using JSON:

1. Not Secure – When it comes to security, JSON is not much secure and has vulnerabilities in it.

2. Limited Data Types – JSON has very limited Data Types available, which are not sufficient to represent the different types of data available nowadays.


Here are the 2 main differences between JSON and XML:

1. Syntax – JSON has a very simple and compact Structure or Syntax.

Whereas XML has a verbose and comparatively hard-to-understand code structure.

2. Converting to JavaScript Object – With JSON, it becomes very easy to convert the JSON Code to JavaScript Object.

Whereas, with XML, it is a tough job to convert the XML Code to JavaScript Object.


In this article, we have discussed some of the most important topics related to JSON, which are:

  1. JSON Overview
  2. JSON Syntax and Examples
  3. How you can open a JSON File
  4. JSON Data Types
  5. Advantages and Disadvantages of using JSON
  6. And finally, the difference between JSON and XML

So, hope you like the article on What is a JSON File. If you have any doubt or suggestion, let us know in the comment section below.

This Post Has One Comment

  1. Jean Médard N'zit

    Very important article about JSON.

Leave a Reply