Free online JSON formatter, validator and viewer
Paste or upload JSON and get a clean, indented result, a precise error message with line and column when something is wrong, and a collapsible tree for exploring deep structures. Everything runs locally in your browser, so API responses, config files and tokens are never uploaded anywhere.
JSON Formatter and Beautifier
Data returned by APIs, logs and databases is often a single dense line with no spaces. That is efficient for machines but almost impossible for a person to read. A JSON formatter, also called a beautifier or pretty-printer, re-writes the same data with line breaks and consistent indentation so the structure becomes obvious at a glance: which keys belong to which object, how deep the arrays go, and where a value is missing.
Choose an indent size from 0 to 8 spaces or a tab, press Format, and the editor is rewritten instantly. Turn on Live to keep the tree view in sync while you type. When you need the opposite, Compact or Minify removes all optional whitespace to give the smallest possible output, and Sort keys orders every object alphabetically, which makes two versions of a file much easier to compare.
How to format JSON online
- Paste your JSON into the editor, type it, or use Open file to load a .json or .txt file. You can also use Load URL to fetch a public endpoint.
- Check the status bar. It says Valid JSON when the data parses, or shows the exact error and position when it does not.
- Pick an indent size and press Format.
- Explore the result in the tree view, or use Copy or Download to take the cleaned data with you.
JSON Validator
Validation checks that your text follows the JSON grammar defined in RFC 8259. The validator reads the whole document and stops at the first problem, reporting what it expected and where. Fix that line, and the next error, if any, appears. Because the check happens on every keystroke in Live mode, you get feedback as you edit instead of after you submit.
Common JSON errors and how to fix them
| Problem | Example | Fix |
|---|---|---|
| Trailing comma | {"a":1,} | Remove the comma after the last item. |
| Single quotes | {'a':'b'} | Use double quotes for keys and strings. |
| Unquoted key | {a:1} | Wrap the key in double quotes: {"a":1}. |
| Missing comma | {"a":1 "b":2} | Separate pairs with a comma. |
| Comments | // note | Delete them. Standard JSON has no comments. |
| Unclosed bracket | [1,2,3 | Add the matching ] or }. |
| Bad value | {"a":undefined} | Use null, a string, number, true or false. |
JSON Editor and Viewer
The left panel works as a lightweight JSON editor with line numbers, tab support and a live cursor position. The right panel is a viewer that turns the same data into a collapsible tree. Click an arrow to open or close an object or array, click any node to see its path, such as $.Object.a, and use Search tree to highlight every key or value that matches your text. Expand all and Collapse all help you move around large documents quickly.
JSON syntax cheat sheet
JSON has only six kinds of value, which is a big reason it is so widely supported.
{
"string": "text in double quotes",
"number": 42.5,
"boolean": true,
"nothing": null,
"array": [1, 2, 3],
"object": { "nested": "value" }
}
- Objects use curly braces and hold key and value pairs separated by commas.
- Arrays use square brackets and hold ordered lists of values.
- Keys must be strings in double quotes, and each key should be unique within its object.
- Numbers have no quotes and cannot start with a leading zero or be written as hex.
- Special characters inside strings, such as quotes, backslashes and new lines, must be escaped with a backslash.
What is JSON?
JSON (JavaScript Object Notation) is a lightweight text format for exchanging structured data between servers, browsers and applications. It grew out of JavaScript object syntax but is language independent, and parsers exist for nearly every programming language. Today it is the default format for web APIs, configuration files, application logs, NoSQL databases and data exports.
JSON compared with XML and YAML
Compared with XML, JSON is shorter because it has no closing tags, and it maps directly onto the objects, lists and strings used in most programming languages. Compared with YAML, JSON is stricter and less forgiving, which makes it easier for programs to parse reliably but a little harder for people to write by hand. A formatter bridges that gap by keeping machine-friendly data readable.
When this tool helps
- Debugging APIs: paste a response from your browser developer tools or a command-line request and see the structure instantly.
- Editing configuration: check a settings or package file for mistakes before you deploy it.
- Reading logs: expand one-line log entries so you can find the field you need.
- Learning: experiment with syntax and get immediate, specific feedback on errors.
- Reducing size: minify data before you embed it in a page or send it over the network.
Private, free and works everywhere
The tool needs no account, no installation and no payment. It runs in current versions of Chrome, Edge, Firefox and Safari on Windows, macOS, Linux, Android and iOS. Because processing happens locally, your data is not stored or logged by this website. Read the Privacy Policy for details.
Frequently asked questions
Is my JSON data uploaded to a server?
No. Formatting, validating, sorting and the tree view all run in your browser with JavaScript. What you paste or open never leaves your device, so it is safe to use with API responses and config files. The only exception is the Load URL button, which makes your browser request the address you enter.
What is the difference between formatting and minifying JSON?
Formatting (also called beautifying or pretty-printing) adds line breaks and indentation so people can read the data. Minifying removes all unnecessary whitespace so the file is as small as possible for transfer or storage. Both produce JSON that means exactly the same thing.
Why does my JSON say it is invalid?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, keys that are not wrapped in double quotes, comments, and a missing bracket or brace. The status bar under the editor shows the error message with its line and column so you can jump straight to the problem.
Can I use this tool to edit JSON?
Yes. The left panel is a normal text editor with line numbers. Type or paste your data, fix any errors the validator reports, then press Format to tidy it. You can also sort keys alphabetically, change the indent size and download the result as a .json file.
How large a file can I open?
There is no upload limit because nothing is uploaded. The practical limit is your device memory and browser. Files of a few megabytes work fine on a modern computer, while very large files may take a few seconds because the editor has to display every line.
Does JSON allow comments or trailing commas?
No. The official JSON standard does not allow comments, trailing commas, single-quoted strings or unquoted keys. Some tools accept these as extensions (often called JSON5 or JSONC), but strict parsers, including the one used here, will report them as errors.