JSON Formatter
Format, validate, and inspect JSON directly in your browser.
{ "id": 123, "name": "DevTools Hub", "url": "https://devtoolshub.io", "features": [ "Fast", "Private", "Works offline" ], "stats": { "tools": 28, "uptime": "99.99%" }, "active": true }
How it works
Formatting re-indents a JSON document with two spaces per level so that nesting is visible at a glance. Minifying does the opposite and strips every space and newline, which is what you want before putting a payload in a header, an environment variable, or a request body.
Both directions parse the document first, so the tool doubles as a validator: if the text is not valid JSON you get the engine's own parse error, including the position where parsing stopped, instead of a generic failure message.
Formatted output is colour-coded by token type, with keys, strings, numbers, booleans, and null each rendered differently. Above 200,000 characters highlighting is skipped and plain text is shown, because at that size tokenising costs more than the colours are worth.
Frequently asked questions
- How do I fix an Unexpected token error in JSON?
- Read the position in the error and look just before it. The usual causes are a trailing comma after the last item, single quotes instead of double quotes, an unquoted key, or a comment. JSON allows none of those.
- Does formatting change the data in my JSON?
- No. The document is parsed and re-serialised, so only whitespace changes. Key order is preserved, but duplicate keys collapse to the last one and very large numbers are rewritten in the precision JavaScript can represent.
- What is the difference between formatting and minifying?
- Formatting adds indentation and newlines to make a document readable. Minifying removes all optional whitespace to make it as small as possible. Both produce the same data, so you can switch between them freely.
- Can it handle a large JSON file?
- Yes, up to whatever your browser tab can hold in memory. Syntax highlighting turns off above 200,000 characters of output, but formatting, minifying, and validation keep working on much larger documents.
- Is my JSON sent to a server?
- No. Parsing and serialising use the browser's built-in JSON functions and the page makes no network requests, so a payload with production data or tokens never leaves your device.