Sitemap

JSON — Java script Object Notation

1 min readJan 23, 2025

Introduction:

It is used as a data interchange format. It is language-independent. It is lightweight—small file size, simple structure.

JSON will support basic datatype like string, number, and boolean and complex datatypes like array and object (key value pair), etc

Why So Popular:

JSON serves as the backbone of most REST APIs. It is widely used in configuration files, as well as for serializing and transmitting structured data. Many modern databases (e.g., MongoDB, PostgreSQL) allow storing and querying JSON data directly. Due to its lightweight nature, JSON is increasingly replacing XML in various applications.

Sample JSON :

{
"emp_name":"xxxxxxxx",
"emp_id" : "EMP0001",
"department" : "IT",
"band" : "S5",
"address" : {
"line_1" : "xxxxxxxx",
"line_2" : "xxxxxxxx",
"state" : "xxxxxx",
"picode": "xxxxxx"
}
"age": 50,
"married" : true,
"hobbies" : ["xxx", "yyyy", "mmm"]
}

Note: JSON will not support comments

Core DataType:

Get Shankar Duraisamy’s stories in your inbox

Join Medium for free to get updates from this writer.

JSON supports the following data types:

  • String: Text data enclosed in double quotes ("example")
  • Number: Integer or floating-point (123, 45.67)
  • Boolean: true or false
  • Null: Represents no value (null)
  • Array: An ordered list of values ([1, 2, "three", true])
  • Object: A collection of key-value pairs ({ "key": "value", "Key_1": "value_1"})

Advantage:

  • Simple and easy to read.
  • Lightweight and faster to parse compared to XML.
  • Supported across a wide range of platforms and languages.
  • Flexible structure allows for hierarchical data.

Limitations:

  • Limited support for comments (unlike some configuration formats like YAML).
  • Does not support advanced data types like dates or binary data directly (these need to be represented as strings or encoded).