---
description: "JSON Tutorial for beginners: JSON stands for JavaScript Object Notation, JSON is a file format used to store information in an organized and easy-to-access manner. Learn JSON file format and example."
title: "JSON Tutorial: Learn with Simple Example"
image: https://www.guru99.com/images/json-tutorial.png
---

[Skip to content](#main)

**⚡ Smart Summary**

JSON, short for JavaScript Object Notation, is a lightweight, human-readable format for storing and exchanging structured data between servers and applications. This resource explains its syntax, data types, real-world applications, and the differences that separate it from XML.

- 🔑 **Core Definition:** JSON stores information as name/value pairs and ordered arrays, using curly braces for objects and square brackets for arrays.
- 🧩 **Supported Data Types:** Master the six JSON data types—string, number, Boolean, null, object, and array—to model almost any structure.
- ⚡ **Why Teams Adopt It:** JSON parses natively in JavaScript, works across all browsers, and integrates with most backend technologies and REST APIs.
- 🔄 **JSON Versus XML:** Compared with XML, JSON is typed, more human-readable, and faster to serialize, although it lacks markup display capabilities.
- 🛠️ **Practical Tooling:** Validate, format, and minify code with utilities such as JSONLint, JSON Editor Online, and JSON Formatter before deployment.

Read More

![JSON Tutorial](https://www.guru99.com/images/json-tutorial.png)

## What is JSON?

**JSON** is a file format used to store information in an organized and easy-to-access manner. Its full form is JavaScript Object Notation. It offers a human-readable collection of data that can be accessed logically. Its filename extension for written programming code is `.json`. The Internet media type for JSON is application/json, and its Uniform Type Identifier is public.json.

Now that the definition is clear, the next section explains why developers choose JSON over other data formats.

## Why use JSON?

Here are the important benefits/ pros of using JSON:

- Provide support for all browsers
- Easy to read and write
- Straightforward syntax
- You can natively parse in JavaScript using eval() function
- Easy to create and manipulate
- Supported by all major JavaScript frameworks
- Supported by most backend technologies
- JSON is recognized natively by JavaScript
- It allows you to transmit and serialize structured data using a network connection.
- You can use it with modern programming languages.
- JSON is text which can be converted to any object of JavaScript into JSON and send this JSON to the server.

## History of JSON

[![History of JSON]()](https://www.guru99.com/images/1/082319_0516_JSONTutoria1.png)

*JSON Tutorial*

Here are important landmarks that form the history of JSON:

- Douglas Crockford specified the JSON format in the early 2000s.
- The official website was launched in 2002.
- In December 2005, Yahoo! starts offering some of its web services in JSON.
- JSON became an ECMA international standard in 2013.
- The most updated JSON format standard was published in 2017.

Beyond this timeline, JSON also offers a set of practical features that explain its lasting popularity.

## Features of JSON

**Easy to use** – JSON API offers high-level facade, which helps you to simplify commonly used use-cases.

**Performance** – JSON is quite fast as it consumes very less memory space, which is especially suitable for large object graphs or systems.

**Free tool** – JSON library is open source and free to use.

**Doesn’t require to create mapping** – Jackson API provides default mapping for many objects to be serialized.

**Clean JSON** – Creates clean, and compatible JSON result that is easy to read.

**Dependency** – JSON library does not require any other library for processing.

### Rules for JSON Syntax

Rules for JSON syntax are:

- Data should be in name/value pairs
- Data should be separated by commas
- Curly braces should hold objects
- Square brackets hold arrays

**Don't Miss:**

- [SOAP Web Services Tutorial: What is SOAP Protocol?](https://www.guru99.com/soap-simple-object-access-protocol.html)
- [What is WSDL? Meaning & Example](https://www.guru99.com/wsdl-web-services-description-language.html)
- [RESTful Web Services Tutorial: REST API Example](https://www.guru99.com/restful-web-services.html)
- [API vs Web Service – Difference Between Them](https://www.guru99.com/api-vs-web-service-difference.html)

## Data Types in JSON

With the syntax rules established, the following table lists the important data types used in JSON:

| Data Type | Description |
| --- | --- |
| Number | It includes real number, integer or a floating number |
| String | It consists of any text or Unicode double-quoted with backslash escapement |
| Boolean | The Boolean data type represents either True or False values |
| Null | The Null value denotes that the associated variable doesn’t have any value |
| Object | It is a collection of key-value pairs and always separated by a comma and enclosed in curly brackets. |
| Array | It is an ordered sequence of values separated. |

### Number

- The number is a double-precision floating-point format which depends on its implementation method.
- In JSON you can’t use Hexadecimal and Octal formats.

Following table displays number types:

| Type | Description |
| --- | --- |
| Integer | Number 1-9, and 0. Both positive and negative numbers. |
| Fraction | Fractions like 3 |
| Exponent | Exponent like e, e+ |

Syntax:

```
var json-object-name = { string : number_value,......}

```

Example:

```
var obj = {salary: 2600}

```

### String

It is a series of double-quoted Unicode characters and having backslash escaping.

The following table shows various string types:

| Type | Description |
| --- | --- |
| \* | Use for double quotation typing |
| / | Use for solidus |
| \\ | Use for reverse solidus |
| B | Use to add backspace |
| F | From feed |
| N | To create a new line |
| R | Use for carriage return |
| T | To show horizontal tab |
| U | Hexadecimal digits |

Syntax:

```
var json-object-name = { string : "string value",…..}

```

Example:

```
var obj = {name: 'Andy'}

```

### Boolean

It stores only true or false values.

Syntax:

```
var json-object-name = {string : true/false, …..}

```

Example:

```
var obj = {active: 'true'}

```

### Array

- It is an ordered collection of values.
- You should use an array when the key names are sequential integers.
- It should be enclosed inside square brackets which should be separated by ‘,’ (comma)

Syntax:

```
[value, .......]
```

Example:

Showing an array storing multiple objects:

```
{
   "eBooks":[
      {
         "language":"Pascal",
         "edition":"third"
      },
      {
         "language":"Python",
         "edition":"four"
      },
      {
         "language":"SQL",
         "edition":"second"
      }
   ]
}

```

### JSON Object

A **JSON Object** is an entity in JSON which is enclosed in curly brackets. It is written in the unordered set of name and value pairs in which the name should be followed by “:” (colon), and the name/value pairs need to be separated using “,” (comma). It can be used when key names are arbitrary strings.

Syntax:

```
{ string :  value, ….. }
```

Example:

```
{
"id": 110,
"language": "Python",
"price": 1900,
}

```

### Whitespace

You can insert whitespace between a pair of tokens.

Example:

Syntax:

```
{string:"    ",….}

```

Example:

```
var a = " Alex"; var b = "Steve";

```

## Example of JSON

The given code example defines how to use JSON to store information related to [programming books](https://www.guru99.com/best-programming-books.html) along with edition and author name.

```
{
   "book":[
      {
         "id":"444",
         "language":"C",
         "edition":"First",
         "author":"Dennis Ritchie "
      },
      {
         "id":"555",
         "language":"C++",
         "edition":"second",
         "author":" Bjarne Stroustrup "
      }
   ]
}

```

Lets understand JSON format with another JSON file example. Here, JSON defines the first name, last name and id of a student.

```
{
  "student": [

     {
        "id":"01",
        "name": "Tom",
        "lastname": "Price"
     },

     {
        "id":"02",
        "name": "Nick",
        "lastname": "Thameson"
     }
  ]
}

```

## Application of JSON

Here are some common applications of JSON:

- Helps you to transfer data from a server
- Sample JSON file format helps in transmit and serialize all types of structured data.
- Allows you to perform asynchronous data calls without the need to do a page refresh
- Helps you to transmit data between a server and web applications.
- It is widely used for JavaScript-based application, which includes browser extension and websites.
- You can transmit data between the server and web application using JSON.
- We can use JSON with modern programming languages.
- It is used for writing JavaScript-based applications that include browser add-ons.
- Web services and Restful APIs use the JSON format to get public data.

Because JSON is so widely applied, it is often compared with XML, the format it frequently replaces.

## JSON vs. XML

Here is the prime difference between JSON vs. XML

| JSON | XML |
| --- | --- |
| JSON object has a type | [XML](https://www.guru99.com/xml-tutorials.html) data is typeless |
| JSON types: string, number, array, Boolean | All XML data should be string |
| Data is readily accessible as JSON objects | XML data needs to be parsed. |
| JSON files are more human-readable. | XML files are less human-readable. |
| JSON is supported by most browsers. | Cross-browser XML parsing can be tricky |
| JSON has no display capabilities. | XML provides a capability to display data because it is a markup language. |
| Retrieving value is easy | Retrieving value is difficult |
| Supported by many Ajax toolkit | Not fully supported by Ajax toolkit |
| A fully automated way of deserializing/serializing JavaScript. | Developers have to write JavaScript code to serialize/de-serialize from XML |
| Native support for object. | The object has to be express by conventions – mostly missed use of attributes and elements. |

### JSON Example

Below is a simple JSON example:

```
{
  "student": [

     {
        "id":"01",
        "name": "Tom",
        "lastname": "Price"
     },

     {
        "id":"02",
        "name": "Nick",
        "lastname": "Thameson"
     }
  ]
}

```

### XML Example

```
<?xml version="1.0" encoding="UTF-8" ?>
<root>
	<student>
		<id>01</id>
		<name>Tom</name>
		<lastname>Price</lastname>
	</student>
	<student>
		<id>02</id>
		<name>Nick</name>
		<lastname>Thameson</lastname>
	</student>
</root>

```

## What is JSON not?

- Sample JSON data file is not a document format.
- It is not a markup language.
- JSON does not provide a general serialization format.
- It is not recurring or cyclical structures.
- It is also not an invisible structure.

## Disadvantages of JSON

Here are few advantages of JSON:

- No namespace support, hence poor extensibility
- Limited [development tools](https://www.guru99.com/software-development-tools.html) support
- No support for formal grammar definition

## Popular JSON Tools (Add-ons)

Here are important JSON tools:

### JSONLint:

JSONLint is an open-source project that is used as a validator and reformatter for JSON. It is a lightweight data-interchange format. Copy and paste, directly type, or input URL in the JSON validator tool to validate your JSON code.

Link: [https://jsonlint.com](https://jsonlint.com/?code=)

### JSON Editor Online:

JSON Editor Online is a useful web-based tool. It allows you to edit, view, and format JSON. It displays your data side by side in a clear, editable [code editor software](https://www.guru99.com/best-coding-software-for-windows-pc.html).

Link: https://jsoneditoronline.org/

### JSON Minifier Tool:

It is a tool which helps you to removes whitespaces and gives a JSON code that takes the least space.

Link: https://www.browserling.com/tools/json-minify

### JSON to XML Converter:

JSON to XML converter is a simple and effective tool which helps you to convert your JSON code.

Link: https://codebeautify.org/jsontoxml

### JSON Formatter:

JSON formatter helps you to solve the problem by formatting the JSON data so that it is easy to read and debug by a human.

Link: https://jsonformatter.curiousconcept.com/

## FAQs

📦 Is JSON a programming language?

No. JSON is a data-interchange format, not a programming language. It only stores and transports structured data using a text-based syntax. Programming languages such as JavaScript, Python, and Java read and write JSON.

🛡️ Is JSON secure to use for data exchange?

JSON itself is plain text and safe. Risks appear when parsing untrusted input, especially with the old eval() method. Use a standard JSON parser, such as JSON.parse(), and validate data to avoid injection issues.

🔀 What is the difference between JSON and a JSON object?

JSON is the text format used to store and transmit data. A JSON object is one structure within that format, written inside curly braces as name/value pairs. A complete JSON file may contain many objects and arrays.

🤖 How is JSON used in AI and machine learning systems?

AI systems use JSON to send prompts, receive responses, and exchange model parameters. Most large language model APIs accept and return JSON, making it the standard format for requests, structured outputs, and training data configuration.

✅ Can AI tools generate and validate JSON automatically?

Yes. AI assistants can generate JSON from plain descriptions and check it for syntax errors. Many tools also enforce a schema, so the output stays valid and matches the structure an application expects.

#### Summarize this post with:

ChatGPTPerplexityGrokGoogle AI

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.**

##### Sign up for the newsletter

Subscribe for Free

You have successfully subscribed.  
Please check your inbox.

![AI-Newsletter]() Chosen by over **350,000+** professionals

[Scroll to top](#wrapper)

×

Search for:

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/json-tutorial.png","url":"https://www.guru99.com/images/json-tutorial.png","width":"700","height":"250","caption":"JSON Tutorial","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/json-tutorial-example.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/web-service","name":"Web Services"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/json-tutorial-example.html","name":"JSON Tutorial: Learn with Simple Example"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/json-tutorial-example.html#webpage","url":"https://www.guru99.com/json-tutorial-example.html","name":"JSON Tutorial: Learn with Simple Example","dateModified":"2026-06-29T18:48:58+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/json-tutorial.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/json-tutorial-example.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/elijah","name":"Elijah Hall","description":"I'm Elijah Hall, a Web Services Development Lead, specializing in offering expert advice on advanced web services development and deployment.","url":"https://www.guru99.com/author/elijah","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/elijah-hall-author.png","url":"https://www.guru99.com/images/elijah-hall-author.png","caption":"Elijah Hall","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Web Services","headline":"JSON Tutorial: Learn with Simple Example","description":"JSON Tutorial for beginners: JSON stands for JavaScript Object Notation, JSON is a file format used to store information in an organized and easy-to-access manner. Learn JSON file format and example.","keywords":"webservice","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/elijah","name":"Elijah Hall"},"dateModified":"2026-06-29T18:48:58+05:30","image":{"@id":"https://www.guru99.com/images/json-tutorial.png"},"copyrightYear":"2026","name":"JSON Tutorial: Learn with Simple Example","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"Is JSON a programming language?","acceptedAnswer":{"@type":"Answer","text":"No. JSON is a data-interchange format, not a programming language. It only stores and transports structured data using a text-based syntax. Programming languages such as JavaScript, Python, and Java read and write JSON."}},{"@type":"Question","name":"Is JSON secure to use for data exchange?","acceptedAnswer":{"@type":"Answer","text":"JSON itself is plain text and safe. Risks appear when parsing untrusted input, especially with the old eval() method. Use a standard JSON parser, such as JSON.parse(), and validate data to avoid injection issues."}},{"@type":"Question","name":"What is the difference between JSON and a JSON object?","acceptedAnswer":{"@type":"Answer","text":"JSON is the text format used to store and transmit data. A JSON object is one structure within that format, written inside curly braces as name/value pairs. A complete JSON file may contain many objects and arrays."}},{"@type":"Question","name":"How is JSON used in AI and machine learning systems?","acceptedAnswer":{"@type":"Answer","text":"AI systems use JSON to send prompts, receive responses, and exchange model parameters. Most large language model APIs accept and return JSON, making it the standard format for requests, structured outputs, and training data configuration."}},{"@type":"Question","name":"Can AI tools generate and validate JSON automatically?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI assistants can generate JSON from plain descriptions and check it for syntax errors. Many tools also enforce a schema, so the output stays valid and matches the structure an application expects."}}]}],"@id":"https://www.guru99.com/json-tutorial-example.html#schema-1125653","isPartOf":{"@id":"https://www.guru99.com/json-tutorial-example.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/json-tutorial-example.html#webpage"}}]}
```
