JSON Formatter
Format, validate, and minify JSON without leaving your browser. Syntax errors show the line, the column, and, when possible, an automatic fix.
Indentation
View
Input JSON
Result
Nothing to show yet
Paste or type a JSON on the left to see the formatted result, the tree, or any validation errors.
How to use the JSON Formatter?
Paste the JSON
Paste or type the JSON in the input field, or load the example to try the tool.
Check the result
The formatted result appears automatically on the side. If there's an error, the exact line and column are shown.
Adjust the format
Pick the indentation and switch between formatted, tree, and minified, depending on what you need.
Copy or download
Copy the result with one click or download it as a .json file.
JSON Formatter Features
Instant formatting
Paste the JSON and see the formatted result right away, with no click needed. Validation happens alongside it, in real time.
Errors with line and column
When the JSON is invalid, the reason is explained in plain language, with the line, the column, and a snippet pointing to exactly where the problem is.
Navigable tree with search
Explore nested objects and arrays in a tree you can expand and collapse, and find any key or value with the search box.
Everything in your browser
Formatting, validation, and minification all run locally. No JSON pasted here ever leaves your browser.
What is JSON?
JSON (JavaScript Object Notation) is a text format for structured data: objects with key-value pairs, lists, strings, numbers, booleans, and null. Despite the name, it doesn't depend on JavaScript. It's the standard format for REST API responses, configuration files, and data exchange between systems, with native support in practically every language.
The syntax of valid JSON
JSON accepts six value types: a double-quoted string, a number, a boolean, null, an object in braces, and an array in brackets. Object keys always use double quotes, never single quotes, and items at the same level are separated by commas, with no trailing comma after the last one.
Example of valid JSON:
{
"name": "Ana",
"active": true,
"age": 30,
"tags": ["dev", "qa"],
"address": null
}What devs and QAs use a JSON formatter for
Formatting and validating JSON comes up in a good part of the daily work of building and testing software:
- Reading an API response that arrives as a single line, with no indentation, straight from DevTools, Postman, or Insomnia
- Validating a payload before sending it, making sure the syntax is correct before debugging the logic
- Inspecting test fixtures and mocks, using the tree to navigate deep structures without getting lost
- Minifying a configuration file or response before committing it or sending it over the network
Common mistakes when writing JSON
Leaving a trailing comma at the end
JSON doesn't accept a comma after the last item of an object or array, unlike JavaScript. It's the most common reason for an error when pasting a JS object straight in as JSON.
Using single quotes
JSON requires double quotes for keys and strings. Single quotes, common in JavaScript objects, make the content invalid as JSON.
Leaving a brace or bracket unclosed
In large, deeply nested payloads, it's easy to lose track of open braces and brackets. The error's line and column point to exactly where a closing one is missing.
Confusing JSON with a JavaScript object
JSON doesn't accept comments, functions, undefined, or unquoted keys. A valid JavaScript object can still be invalid JSON, even when it looks identical.
Frequently Asked Questions about the JSON Formatter
Everything you need to know to format, validate, and debug JSON day to day.