Learn what JSON is, how its syntax works, and where it's used, with simple examples of JSON objects, arrays, and data types.
JSON stands for JavaScript Object Notation. It’s a lightweight, text-based format for storing and exchanging structured data, and it’s become the standard way most modern applications send data back and forth.
JSON stands for JavaScript Object Notation. The name comes from the fact that its syntax is based on how objects are written in JavaScript. Despite the name, JSON isn’t tied to JavaScript: it’s a plain text format that almost every modern programming language can read and write, including Python, PHP, Java, Ruby, and Go.
Here’s a simple JSON object describing a person:
{
"name": "John",
"age": 30,
"city": "London"
}
This is an object, shown by the curly braces { }. Inside it are three key-value pairs. Each key (like "name") is a label written in double quotes, followed by a colon and its value (like "John"). Pairs are separated by commas.
JSON supports a small, fixed set of value types:
"London"30true or falseAn object groups related values under named keys. An array is an ordered list of values, written in square brackets and separated by commas:
["Apple", "Banana", "Orange"]
Objects and arrays can be combined and nested inside each other. Here’s a more realistic example:
{
"name": "John",
"age": 30,
"isEmployed": true,
"address": {
"city": "London",
"postcode": "E1 6AN"
},
"hobbies": ["reading", "cycling", "chess"]
}
Here, address is an object nested inside the outer object, and hobbies is an array of strings. Nesting is what lets JSON represent complex, real-world data.
true, false, and null are written without quotes.Breaking any of these rules produces invalid JSON that most parsers will reject.
Before JSON became dominant, XML was the standard format for exchanging structured data. Both can represent the same information:
| JSON | XML |
|---|---|
|
|
JSON is generally more compact and easier to read at a glance, which is part of why it overtook XML for most web APIs. XML supports some things JSON doesn’t natively, like attributes and comments, and is still common in document formats and older enterprise systems. Neither format is universally “better”: the right choice depends on what a system already uses and needs.
Hand-written JSON is easy to get wrong: a missing comma or an extra bracket is enough to break it. The JSON Formatter & Validator checks your JSON for syntax errors and points out exactly where the problem is, and can also reformat cramped or minified JSON into a readable, indented layout. If you’re moving data between formats, the JSON to CSV Converter and CSV to JSON Converter tools convert JSON and CSV in either direction.
JSON often shows up alongside other data-handling concepts. If your data needs to travel through binary-unsafe channels, see What Is Base64 Encoding?; if it’s being placed into a URL, see What Is URL Encoding?; and if you need to search or validate JSON string values, see Regex Explained for Beginners.
JSON Formatter & Validator
JSON stands for JavaScript Object Notation. It describes the syntax the format uses, not a programming language.
No. JSON is a data format, not a programming language. It has no logic, functions, or instructions; it only describes data using objects, arrays, and a small set of value types.
JSON is most commonly used to exchange data between a server and a client, such as an API sending data to a web or mobile app. It’s also used for configuration files and, in some databases, for storing records directly.
Both formats represent structured data, but JSON uses a more compact syntax based on objects and arrays, while XML uses nested tags similar to HTML. JSON is generally easier to read and parse, while XML supports additional features like attributes and comments.
Yes. Arrays are one of JSON’s core data types, written in square brackets. An array can hold strings, numbers, objects, other arrays, or a mix of these.
The JSON specification requires double quotes for strings and keys. Single quotes are not valid JSON, even though some programming languages (including JavaScript itself) allow them for strings in their own code.
Find the right tool, or keep reading Brekzy's other guides.