JSON Format Guide — What is JSON?

JSON (JavaScript Object Notation) is the most widely used data interchange format on the web. This guide explains JSON structure, syntax rules, data types, and real-world examples.

What is JSON?

JSON stands for JavaScript Object Notation. It is a lightweight, text-based data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. Despite its name, JSON is language-independent — it is supported natively by Python, Java, PHP, Ruby, C#, Go, and virtually every other programming language.

JSON was derived from JavaScript object syntax and standardized as RFC 8259. It is the standard data format for REST APIs, web applications, configuration files, and NoSQL databases.

JSON Syntax Rules

  • Data is represented as key-value pairs
  • Keys must be strings enclosed in double quotes
  • Values can be string, number, boolean, null, object, or array
  • Key-value pairs are separated by commas
  • Objects are enclosed in curly braces {}
  • Arrays are enclosed in square brackets []
  • No trailing commas are allowed
  • No comments are allowed in standard JSON

Common mistake: Single quotes are not valid in JSON. All strings — including keys — must use double quotes.

JSON Data Types

JSON supports exactly six data types:

String

Text in double quotes

"Hello, World!"

Number

Integer or float

42 or 3.14

Boolean

true or false (lowercase)

true

Null

Empty / no value

null

Object

Key-value pairs

{"key": "val"}

Array

Ordered list of values

[1, 2, 3]

JSON Examples

Simple JSON Object

{ "name": "John Doe", "age": 28, "city": "New York", "active": true, "score": null }

JSON Array of Objects

This is the most common output when converting CSV to JSON:

[ { "id": 1, "name": "Alice", "email": "alice@example.com" }, { "id": 2, "name": "Bob", "email": "bob@example.com" } ]

Nested JSON Object

JSON objects can be nested to represent hierarchical data:

{ "user": { "id": 101, "name": "Jane Smith", "address": { "street": "123 Main St", "city": "London", "country": "UK" }, "hobbies": ["reading", "coding", "hiking"] } }

JSON vs CSV Format

CSV stores the same data as flat rows — JSON can represent nested relationships. If you have a CSV file and need it in JSON format, use our free CSV to JSON converter. For a detailed comparison, read our CSV vs JSON guide.

How to Validate JSON

To check if your JSON is valid:

  • Use JSON.parse() in a browser console — throws an error if invalid
  • Use JSONLint.com for online validation
  • Most code editors (VS Code, WebStorm) highlight JSON errors automatically

Using JSON in JavaScript

// Parse JSON string to object const jsonStr = '{"name":"John","age":28}'; const obj = JSON.parse(jsonStr); console.log(obj.name); // "John" // Convert object to JSON string const data = { name: "Jane", age: 32 }; const json = JSON.stringify(data, null, 2); console.log(json);

Have a CSV File to Convert to JSON?

Use our free online tool — paste your CSV and get properly formatted JSON instantly.

Convert CSV to JSON Free →