JSON Guide
What JSON is, how to use the parser, and common errors to fix.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based format for storing and exchanging data. It is easy for humans to read and write, and easy for machines to parse and generate. Although it grew out of JavaScript, JSON is language-independent and is used by virtually every programming language. You will find it almost everywhere modern software communicates — in REST and GraphQL APIs, configuration files, databases, log files, and browser local storage.
A small example of a JSON document looks like this:
{
"name": "Ada Lovelace",
"age": 36,
"isMember": true,
"roles": ["admin", "editor"],
"address": {
"city": "London",
"zip": "W1A 1AA"
},
"nickname": null
}JSON syntax rules
JSON is built from just two structures and a handful of value types:
- Objects are wrapped in curly braces
{ }and contain"key": valuepairs. - Arrays are wrapped in square brackets
[ ]and contain an ordered list of values. - Values can be a string, number, boolean (
true/false),null, an object, or an array. - Keys must be double-quoted strings, and items are separated by commas — with no trailing comma after the last item.
- Strings use double quotes (not single quotes), and comments are not allowed in standard JSON.
How to use JSON View Parser
- Paste or type your JSON into the Input panel on the left of the home page. It validates automatically as you type.
- Press Parse (or Ctrl + Enter) to process the document. If anything is wrong, you will see the exact line and column of the error.
- Read the output in whichever view suits you: the Pretty Print tab for clean, colorized code, the Collapsible Tree tab to expand and explore nested data, or the Statistics tab for insights such as size and depth.
- Format or minify with one click to re-indent your JSON or compress it to a single line.
- Search within the output, or load a sample to experiment.
Power users can work entirely from the keyboard. Press Alt + / at any time to open the full list of keyboard shortcuts.
Common JSON errors and how to fix them
1. Trailing comma
A comma after the last item is invalid in JSON.
// ❌ Invalid // ✅ Valid
{ {
"a": 1, "a": 1,
"b": 2, "b": 2
} }2. Single quotes instead of double quotes
JSON requires double quotes for both keys and string values.
// ❌ Invalid // ✅ Valid
{ 'name': 'Ada' } { "name": "Ada" }3. Unquoted keys
Every key must be wrapped in double quotes.
// ❌ Invalid // ✅ Valid
{ name: "Ada" } { "name": "Ada" }4. Missing or mismatched brackets
Every { needs a matching }, and every [ a matching ].
// ❌ Invalid // ✅ Valid
{ "list": [1, 2, 3 } { "list": [1, 2, 3] }5. Comments
Standard JSON does not support // or /* */ comments. Remove them, or move notes into a dedicated string field.
Tip: when you hit any of these, use our tool to pinpoint the exact line and column of the error, then correct it in the Input panel.
Tips and best practices
- Use 2-space indentation for readable, diff-friendly JSON.
- Minify JSON before sending it over a network to reduce payload size.
- Validate JSON from external sources before relying on it — a single stray character can break parsing.
- Keep keys consistent (for example all
camelCase) across your data. - Remember that JSON has no date type — dates are usually stored as ISO-8601 strings, e.g.
"2026-06-06".
More JSON articles
JSON Parser
A guide to parsing JSON data.
JSON Validator
Syntax checking and validation.
JSON Formatter
Beautify, indent and pretty print.
JSON Viewer
Interactive tree exploration.
JSON Minifier
Compress JSON for production.
JSON Arrays
Working with ordered lists.
JSON Objects
Mastering key-value pairs.
JSON Syntax
The complete rulebook.
JSON Schema
Defining data structures.
JSON APIs
REST & GraphQL data exchange.
JSON vs XML
Comparing popular formats.
JSON vs YAML
Machine vs Human focus.
JSON vs CSV
Hierarchical vs Tabular.
JSON Escape
Handling special characters.
JSON Errors
Troubleshooting guide.
JSON Examples
Sample data snippets.
Best Practices
Designing efficient APIs.
JSON History
The origin of the format.
Data Types
Strings, Numbers, and more.
JSON vs JSON5
The 'relaxed' alternative.
JSON in Python
Using the json module.
JSON in Java
Jackson and Gson guides.
JSON in PHP
encode and decode functions.
JSON in Go
Structs and marshaling.
JS Validation
Parsing JSON safely in JS.
Ready to try it? Head back to the JSON parser, or learn more about this tool.