JSON Formatter & Error Reviewer
Validate, pretty-print, and minify JSON. Pinpoint syntax errors by line and column.
- [FREE]
- [NO_SIGNUP]
- [NO_UPLOAD]
How to use the JSON formatter and error reviewer
- Paste your JSON. The Input pane on the left accepts any text — strict JSON, broken JSON, or JSONC (JSON with comments). Validation runs continuously.
- Choose Pretty or Minify. Pretty re-indents with the indent you pick (2, 4, or tab). Minify strips every whitespace character not inside a string.
- Sort keys when diffing. Toggle Sort keys to alphabetize every object key recursively. Two files that differ only in key order become byte-identical after sorting.
- Enable JSONC mode for config files.
tsconfig.json, VS Code settings, and other “JSON-ish” formats allow comments and trailing commas. Toggle JSONC mode and the tool strips them before validating. - Read the error pointer. If parsing fails, the status bar shows the exact line and column, plus a snippet of the input around that spot. Fix the character and the error disappears.
Common JSON errors and how to fix them
Unquoted keys
Invalid:
{ name: "ada" }
Valid:
{ "name": "ada" }
JSON requires all object keys to be double-quoted strings. JavaScript object literals do not — that is the most common confusion.
Single quotes
Invalid:
{ 'name': 'ada' }
Valid:
{ "name": "ada" }
JSON only accepts double quotes for strings. Single quotes are a JavaScript thing.
Trailing commas
Invalid (strict JSON):
[1, 2, 3,]
Valid (strict JSON):
[1, 2, 3]
Toggle JSONC mode to accept the trailing-comma form.
Comments
Invalid (strict JSON):
{
// this is a comment
"a": 1
}
Toggle JSONC mode and // and /* … */ comments are stripped before parsing.
Numbers
Invalid: 007, .5, 5., Infinity, NaN.
Valid: 7, 0.5, 5.0, 1e10.
If you need to preserve 007 or NaN, store them as strings.
Bad escape sequences
Inside strings, only these escapes are valid: \", \\, \/, \b, \f, \n, \r, \t, \uXXXX. Anything else like \x41 or \d is a syntax error.
What JSONC mode handles
| Feature | Strict JSON | JSONC mode |
|---|---|---|
// line comments | ✗ | ✓ |
/* block comments */ | ✗ | ✓ |
| Trailing commas | ✗ | ✓ |
| Unquoted keys | ✗ | ✗ |
| Single-quoted strings | ✗ | ✗ |
JSONC is a superset of JSON used by tsconfig.json, VS Code settings, and several other tools. It is not the same as JSON5, which allows more (hex numbers, unquoted keys, single quotes); this tool does not implement JSON5.
Privacy and security
The JSON formatter is a single HTML page with a small JavaScript bundle. Your input never leaves your device. The share link encodes state in the URL fragment (#…) — that part of a URL is not sent to servers. You can verify by opening DevTools → Network and watching for requests while you type.
Related tools
- JSON to CSV Converter — turn JSON into CSV (or back) in your browser.
- Regex Tester — test and debug regular expressions on the same kind of data.
- JWT Decoder & Verifier — decode and verify tokens whose payload is JSON.
Frequently asked questions
Is my JSON sent to a server?
No. Everything runs in your browser tab. Open DevTools → Network and you will see no outbound request with your input. The share link encodes state into the URL hash (#…), which the browser does not transmit to servers.
How does the error pointer find the right line and column?
When JSON.parse throws, the tool reads the byte offset out of the error message (Chrome and Firefox include "position N" or "line L column C") and converts it to a line/column in your input. When the message omits the offset, a small built-in scanner finds the first invalid token. Either way you get a snippet of the surrounding characters so you can see what went wrong.
What is JSONC mode?
JSONC stands for "JSON with Comments". Toggling JSONC mode strips // line comments, /* block */ comments, and trailing commas before parsing. It does not modify your input; you still copy the cleaned output back. Use it for VS Code settings, tsconfig.json, and similar files that are not strict JSON.
Why does the formatter reject leading zeros and trailing dots in numbers?
The JSON spec forbids them. 007 and 1. are valid in JavaScript but not in JSON. If you need them preserved as-is, store them as strings ("007", "1.") and convert in your application.
What does "Sort keys" do?
Recursively re-orders every object key alphabetically. Arrays keep their original order. Useful when diffing two JSON files where key order varies, or when normalizing config files for a stable hash.
Can I format very large JSON files?
Yes, up to whatever your browser can hold in memory — typically tens of megabytes. Pretty-printing scales linearly with input size. For multi-hundred-megabyte files prefer a streaming tool; this is built for the common case of inspecting a single API payload or config file.
Why does my output have no whitespace?
You are in Minify mode. Click Pretty to add indentation back. The indent dropdown (2 spaces, 4 spaces, tab) is disabled in Minify mode because minified JSON has no whitespace by definition.
Are duplicate keys flagged?
JSON.parse silently keeps the last value for duplicate keys, matching the ECMAScript spec. This tool does not warn separately, but pretty-printing the result reveals the collapsed structure so you can see what survived.
How do I save a session to share with a teammate?
Click "Copy share link". The current input, mode, indent, sort-keys toggle, and JSONC toggle are encoded into the URL after #. Paste the URL in chat or a doc. No server stores the data.
Is this JSON tool really free?
Yes. No signup, no account, no ads, no telemetry on your input. The source is on the project repository.