What is JSON

JavaScript Object Notation (JSON)

As the name suggests, JSON is an object notation (or symbol) for JavaScript. JSON was mainly developed for JavaScript. It helps JavaScript to communicate with server. We will now discuss how a JSON file is made and how it is implemented in our JavaScript code.

JSON Syntax

A JSON can be defined as an individual file with json [.json] extension or, within JavaScript an object can be defined and JSON can be assigned to it. Both of these JSONs will have the same structure. Let us understand JSON with an example:

JSON Syntax

From above example, we can derive following:

  • JSON Data is in name value pair (e.g. “name”: “Batman”)
  • JSON Data are separated via commas
  • Curly braces hold JSON objects
  • Square brackets hold JSON arrays
  • JSON values can be one of the following:
    • a string (written within double or single quotes [e.g. “Batman” or ‘Batman’, both are correct])JSON String
    • a number (written without any quote e.g. “age”: 53)JSON Number
    • an object (JSON object e.g. “Emp_detail” here is an object)
      JSON Object
      Note: We can even have an array of object or object of arrays. If an object has multiple arrays, it will be called object of arrays. And if, an array includes multiple objects, it will be called an array of objects. We will learn more about this in upcoming assignment section.
    • an array (JSON array e.g. “powers” here is an array)
      JSON ArrayNote: We can even have an array of array i.e. array inside an array. We will learn more about this in upcoming assignment section.
    • a Boolean (It can have true or false as a value, e.g. “active”)JSON Boolean
    • null (It can be also assigned, if values are not available; e.g. Middle name for a person can be a null)

In generic, JSON syntax can be defined as below:

Simple JSON

Here, name can be any unique string, and value can be either a string, number, array or object.


A JSON data can be used to load data into a table or wherever required. Below you can find the output for the JSON we have mentioned in the intro part of JSON:


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.