---
title: "JSON Data Types in JavaScript"  
description: "JSON (JavaScript Object Notation) is a lightweight data format used for storing and exchanging data. It is easy to read and write for humans and machi"  
author: "Ashutosh Patel"  
published: 2025-03-19  
updated: 2025-03-19  
canonical: https://www.mindstick.com/articles/338810/json-data-types-in-javascript  
category: "javascript"  
tags: ["javascript", "json", "javascript object", "jsonobject"]  
reading_time: 3 minutes  

---

# JSON Data Types in JavaScript

[JSON](https://www.mindstick.com/articles/336230/explain-the-json-in-javascript) (JavaScript Object Notation) is a lightweight data format for storing and exchanging data. It is easy to read and write for humans and machines. JSON is commonly used in APIs to send and [receive data](https://www.mindstick.com/interview/22931/will-these-phones-have-world-phone-capabilities-with-the-ability-to-make-calls-receive-data-in-other-countries-or-will-they-be-able-to-use-google-voice-to-make-calls) between a client and a server.

## Sample:

```plaintext
{
 "name": "Ashutosh",
 "age": 25,
 "isDeveloper": true,
 "skills": ["JavaScript", "C#", "SQL"],
 "address": {
   "city": "Prayagraj",
   "country": "India"
 },
 "experience": null
}
```

#### JSON Data Types

JSON supports **six** data types:

| **Data Types** | **Description** | **Examples** |
| --- | --- | --- |
| String | Sequence of [characters](https://answers.mindstick.com/qa/42112/who-is-the-originator-of-avengers-characters) enclosed in double quotes | `"JavaScript"` |
| Number | Integer or floating-point number | `25`, `3.14` |
| Boolean | It represents [True or False](https://www.mindstick.com/forum/160329/how-can-you-convert-a-value-to-a-boolean-true-or-false-in-javascript) values | `true`, `false` |
| Array | It represents Ordered list of values | `["C#", "JavaScript", "SQL"]` |
| Object | Key-value pairs like a [dictionary](https://answers.mindstick.com/qa/37821/which-word-was-declared-as-2017-s-word-of-the-year-by-oxford-dictionary) | `{"city": "Prayagraj", "country": "India"}` |
| Null | It represents an empty or unknown value | `null` |

**A. JSON String** (Text Data)

Strings in JSON must be enclosed in double quotation marks (" "), while single quotation marks (' ') are also allowed in JavaScript.

```plaintext
{
 "language": "JavaScript"
}
```

**B. JSON Number** (Integer & Floating Point)

JSON supports **integers** and **floating-point numbers** without quotation marks.

```plaintext
{
 "age": 25,
 "price": 99.99
}
```

**C. JSON Boolean** (`true` or `false`)

The boolean datatype values ​​represent true or false.

```plaintext
{
 "isStudent": false,
 "isVerified": true
}
```

**D. [JSON Array](https://www.mindstick.com/forum/12870/how-to-parse-json-array-using-newtonsoft)** (List of Values)

An array in JSON is an ordered list of values. It can contain **strings**, **numbers**, **objects**, or **other arrays**.

```plaintext
{
 "skills": ["JavaScript", "C#", "SQL"]
}
```

**E. [JSON Object](https://www.mindstick.com/forum/1861/what-type-to-give-a-json-object)** (Key-Value Pairs)

An object is a [collection](https://www.mindstick.com/interview/2199/what-is-the-collections-api-in-java) of key-value pairs, similar to a JavaScript object.

```plaintext
{
 "address": {
   "city": "Prayagraj",
   "country": "India"
 }
}
```

**F. JSON Null** (Empty Value)

The `null` represents an **empty or missing value**.

```plaintext
{
 "experience": null
}
```

#### Parsing and Stringifying JSON in JavaScript

**Convert JSON to JavaScript Object (**`JSON.parse()`**)**

```plaintext
let jsonString = '{"name": "Ashutosh", "age": 25, "isDeveloper": true}';
let jsonObject = JSON.parse(jsonString);
console.log(jsonObject.name); // Output: Ashutosh
```

**Convert JavaScript Object to JSON (**`JSON.stringify()`**)**

```plaintext
let user = { name: "Ashutosh", age: 25, isDeveloper: true };
let jsonData = JSON.stringify(user);
console.log(jsonData); // Output: '{"name":"Ashutosh","age":25,"isDeveloper":true}'
```

**Key JSON Rules & [Best Practices](https://www.mindstick.com/articles/337564/building-a-microservices-architecture-with-laravel-best-practices)**

- Use double quotes `("")` for keys and strings.
- Numbers and booleans should not be in quotation marks.
- Objects should use `{}` and arrays should use `[]`.
- Values ​​can be nested objects or arrays.
- Use `null` for missing or unknown values.
- Always parse (`JSON.parse()`) or stringify (`JSON.stringify()`) when handling JSON in JavaScript

Thanks!

Also, Read: [Explain the JavaScript AJAX Response](https://www.mindstick.com/articles/338808/explain-the-javascript-ajax-response)

---

Original Source: https://www.mindstick.com/articles/338810/json-data-types-in-javascript

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
