Javascriot object notation json
Javascriot object notation json

What is JSON?

JavaScript Object Notation(JSON) is a standard text based data format used in application development to send and receive data in JSON format, JSON is basically used to transfer sets of data from server to client or vise versa, Here data is formatted in key-value pair and separated by using commas.

Example of JSON data format

{"firstName":"Rajat", "lastName":"Palankar"}

JSON Array of Object Example

    {"firstName":"Rajat", "lastName":"Palankar"},
    {"firstName":"Manoj", "lastName":"Anvekar"},
    {"firstName":"Peter", "lastName":"England"}

Where are JSON been used?

Now a days, JSON data is been to build various applications throught out the world in IT field, Here are few common area where JSON is used:

  1. Web APIs: JSON is most popular format for data exchanging between web servers and client application and are commonly used in building API’s like for example Weather service, Payment gateway, social media platforms.
  2. Data Storage: JSON are also used in NoSQL databases like MongoDb and CouchDB. The database store JSON documents and make it suitable choice to make application flexible and schema-less data storage.

IoT (Internet of Things): Now a days JSON data is been used in IoT applications also mainly for exchanging data between IoT devices and servers. As JSON data is lightweight it makes it suitable for resource-constrained devices.

Mobile App Development: JSON is commonly used in mobile app development for data storage, communication with APIs, and configuration files.

Data Transformation: JSON is used in data transformation processes where data is converted from one format to another. For example, ETL (Extract, Transform, Load) processes often involve transforming data into JSON format for easier processing.

and many more

Advantage of using JSON

  • It is a light weight database standard, so data transmission is much faster.
  • It can be used on all platforms.
  • It is supported by all programming langauges.

Data types supported in JSON

  • String
  • Number
  • Arrays
  • null
  • Boolean
  • Objects

JSON Methods in Javascript

JSON,parse(): Takes JSON String and convert it into JavaScript Object.

JSON.stringify(): Convert JavaScript Object(JSON) into JSON String (Useful while sending over the network).

JSON Syntax and Example

JSON syntax and example
  "name": "Rajat Palankar",
  "age": 30,
  "email": "",
  "isSubscribed": true,
  "hobbies": ["reading", "hiking", "swimming"],
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "zipcode": "12345"

In this example:

  • JSON data is enclosed in curly braces {}.
  • Data is represented as key-value pairs, where the key is a string enclosed in double quotes, followed by a colon :, and then the corresponding value.
  • Strings must be enclosed in double quotes.
  • Numeric values don’t need quotes.
  • Boolean values are true or false.
  • Arrays are represented using square brackets [] and can contain multiple values of different types.
  • Objects (nested structures) can be used as values for keys, creating a hierarchical structure within JSON.

Recent Articles

How to read JSON file in flutter dart

Flutter Auto Create Model from JSON Files

How to parse JSON Data in Flutter

How to convert array to collection in Javascript