What is the JSON Formatter?
The JSON Formatter turns compact or messy JSON into neatly indented text that is easy to read and review. Paste an API response, a config file or a log line and it is formatted instantly as you type.
If the JSON has a mistake, such as a missing comma, a trailing comma or a single-quoted string, the formatter tells you what is wrong and the exact line and column, and can jump straight to it. Everything happens in your browser, so private data never leaves your device.
How to use it
- Paste your JSON into the Input box, upload a .json file, or click Example.
- Pick an indent (2 spaces, 4 spaces or tab). Turn on Sort keys or Allow comments if you need them.
- The formatted JSON appears on the right as you type. Press Format or Ctrl/Cmd + Enter at any time.
- Copy the result or download it as a .json file.
Example
{"name":"Nova Free Tools","free":true,"tools":101,"tags":["pdf","json"]}{
"name": "Nova Free Tools",
"free": true,
"tools": 101,
"tags": [
"pdf",
"json"
]
}Features
- Live formatting. The output updates as you type or paste, with colour highlighting for keys, strings and numbers.
- Exact error location. Plain-English messages with the line and column, plus a button that selects the problem in the input.
- Exact numbers. Numbers and escapes are kept exactly as written, so long IDs are never rounded.
- Sort keys. Orders object keys alphabetically at every level, which makes two files easy to compare.
- Comments and trailing commas. Optional support for JSONC-style config files such as tsconfig.json and VS Code settings.
- Duplicate key warnings. Flags keys that appear twice in the same object, a common source of silent bugs.
- Private. Nothing is uploaded. The formatter works offline once the page has loaded.
Frequently asked questions
Is my JSON sent to a server?
No. Formatting happens entirely in your browser with JavaScript. Your JSON is never uploaded, logged or stored.
Why does it say my JSON is invalid?
JSON is strict: keys and strings need double quotes, there can be no trailing commas and no comments. The message tells you the exact line and column. If your file is a config file with comments, turn on Allow comments.
What does Sort keys do?
It reorders the keys of every object alphabetically, including nested objects. Array order is never changed, because order matters in arrays.
How big a file can I format?
Files of several megabytes format in well under a second on most computers. For very large files the colour highlighting is switched off to keep the page fast.
Does formatting change my data?
No. Only whitespace changes (and key order if you choose Sort keys). Numbers and strings are kept exactly as you wrote them, so long IDs like 12345678901234567890 are never rounded, unlike many online formatters.
Last updated · Free, no sign-up, runs in your browser.