What Is JSON? A Simple Guide with Examples

JSON is a simple text format for storing and sharing structured data. JSON stands for JavaScript Object Notation, but you do not need to know JavaScript to read or use it.

By Archana Bhandari ·

What does JSON stand for?

JSON full form is JavaScript Object Notation. It began with a style used in JavaScript, but it is now a language-independent data format used by many kinds of software.

Think of JSON as a neat way to label information. Instead of sending a loose list of values, JSON says what each value means.

What does JSON look like?

Here is a small JSON example. The curly brackets { } hold one JSON object: a group of related information.

{
  "name": "Rahul",
  "age": 28,
  "city": "Dehradun"
}
  • "name", "age", and "city" are keys. A key is the label for a value.
  • "Rahul", 28, and "Dehradun" are values. They are the actual pieces of data.
  • Keys and text values use double quotes. Commas separate each key-value pair.

What is JSON used for?

JSON is commonly used whenever one piece of software needs to pass structured information to another. It is especially common in APIs, which are ways for apps and websites to request data from a server.

  • Websites sending data between the frontend you see and the backend server.
  • Mobile apps loading profiles, orders, messages, or settings.
  • Configuration files that tell a tool how to behave.
  • Storing structured information such as products, users, or addresses.

How does JSON work?

A simple flow is: Website or app → JSON → Server or API. For example, when you open an account page, the website can ask its API for your profile. The API replies with JSON, and the website shows the name and city in the right places. Here, true is a yes/no value the app can use to decide whether Amit is signed in.

{
  "name": "Amit",
  "city": "Delhi",
  "loggedIn": true
}

JSON data types

JSON supports a small set of data types. A string is text, a number is a numeric value, a boolean is true or false, and null means no value is currently available. An object groups labelled values, while an array is a list of values.

{
  "name": "Neha",
  "score": 95,
  "subscribed": false,
  "middleName": null,
  "address": { "city": "Chandigarh" },
  "subjects": ["Maths", "Science"]
}

JSON object example

A JSON object is information inside curly brackets. It is useful when the values have names, such as a person, product, or address. In the example above, address is an object inside another object.

JSON array example

A JSON array is a list inside square brackets [ ]. The items can be text, numbers, objects, or even other arrays. In this example, cities is a key and its value is a list of three city names.

{
  "cities": ["Delhi", "Dehradun", "Mumbai"]
}

JSON object vs JSON array

Use an object when you need labelled details: { "name": "Rahul" }. Use an array when you need a list: ["Delhi", "Mumbai"]. In real JSON data, objects and arrays are often used together.

What is a JSON file?

A JSON file is a plain text file that contains JSON data. Its filename usually ends in .json, for example config.json or users.json. You can open it in a text editor, but changing it carelessly can make the JSON invalid.

Is JSON a programming language?

No. JSON is a data format, not a programming language. It cannot run instructions or perform calculations by itself. Programs in JavaScript, Python, Java, PHP, and many other languages can read and create JSON.

JSON vs JavaScript

JSON was inspired by JavaScript object syntax, so the two can look similar. The important difference is that JSON is strict: keys and text strings need double quotes, and JSON does not allow functions or comments. JSON is not tied to JavaScript; many programming languages use it.

What does valid JSON look like?

This is valid JSON. Every key uses double quotes, each line except the last has a comma, and there is no comma after the final value.

{
  "product": "Notebook",
  "price": 60,
  "available": true
}

A small invalid JSON example

The following is invalid JSON because name is missing double quotes and there is a trailing comma after the final value. If you already have JSON and are not sure whether it is valid, paste it into the JSONPlease JSON Validator. It checks the JSON locally in your browser and shows where the problem is. Use the JSON Formatter when valid JSON is difficult to read.

If the data is malformed and you want help correcting common syntax mistakes, JSONPlease also has a JSON Repair tool.

{
  name: "Rahul",
  "age": 28,
}

Why is JSON so common?

JSON is easy for people to read once they know the basic punctuation, and it is straightforward for software to process. It is a text format, works across programming languages, and is widely used with APIs. That combination makes it a practical default for sharing structured data.

Simple real-world JSON example

An online shop might use JSON like this to describe a product. product is text, price is a number, inStock is a boolean, and colors is an array. A website can use these values to show the product name, price, stock status, and colour choices.

{
  "product": "Wireless Mouse",
  "price": 799,
  "inStock": true,
  "colors": ["Black", "White"]
}

Common JSON mistakes beginners make

Most JSON errors are small punctuation problems. Check the brackets, quotes, and commas before looking for a bigger issue.

  • Using single quotes instead of double quotes.
  • Missing a comma between values, or adding an extra comma at the end.
  • Leaving a key without double quotes.
  • Using the wrong closing bracket or brace.
  • Putting an unescaped double quote inside a text value.

Frequently asked questions

What does JSON stand for? JSON stands for JavaScript Object Notation.

What is JSON used for? It stores and exchanges structured data, especially between websites, apps, servers, and APIs.

Is JSON a programming language? No. It is a data format.

Is JSON easy to learn? Yes. The basics are a few rules about keys, values, quotes, commas, objects, and arrays.

What is a JSON file? It is a text file containing JSON data, usually with the .json extension.

What is the difference between JSON and XML? Both store structured data, but JSON normally uses braces and brackets while XML uses opening and closing tags.

Can JSON contain arrays? Yes. Arrays are lists inside square brackets.

Does JSON support comments? No. Standard JSON does not allow comments.

Keep learning JSON

Once these basics make sense, the next useful step is learning how to write JSON, recognise its syntax, and fix common errors.

Related JSON tools