Formatted JSON will appear here.
JSON Formatter & Validator Online
What is the JSON Formatter & Validator?
The JSON Formatter & Validator takes raw JSON, from an API response, a config file or a log line, and pretty-prints it with proper indentation, validates it, and if it is broken tells you where: the line and character of the first error and what the parser expected. It can also minify valid JSON for storage, show a collapsible tree for large documents, and copy or download the result. Everything runs in your browser, so API keys or customer records in the payload never leave your machine.
How to use it
- Paste JSON into the input.
- Click Format. Valid input is re-indented; invalid input shows an error with the position highlighted.
- Fix the error (common ones below) and format again.
- Switch to Tree to collapse and expand nested objects, or Minify for the compact form.
- Copy or download.
The errors you will see most
- Unexpected token at a position: usually a trailing comma after the last item, single quotes instead of double, or an unquoted key.
- Unexpected end of input: a missing closing brace or bracket, often because the copy was truncated.
- Unexpected token ‘<‘: you pasted an HTML error page, not JSON; the API returned an error.
- Comments: JSON does not allow them. Remove // and /* */ lines.
- NaN, undefined, Infinity are not valid JSON values.
How to read each message, the difference between JSON and a JavaScript object literal, and how to handle JSON5, JSONC and large files, is in how to format, validate and debug JSON.
Features
- Precise errors with line and column, not just “invalid JSON”.
- Format, minify and tree view in one place.
- Indent choice: 2 spaces, 4 spaces or tabs.
- Large documents: multi-megabyte responses format in about a second.
- Private: nothing is uploaded or logged.
Related tools
Decode Base64 fields in a payload with the Base64 Decoder, tidy the surrounding code with the HTML, CSS & JS Formatter, and test a pattern against string values with the Regex Tester.
Read the guide
How to Format, Validate and Debug JSON (and Fix “Unexpected Token” Errors)
Formatting, validating and minifying JSON, the syntax rules that cause most "Unexpected token" errors, how to read validator messages, and a workflow for debugging API responses.
Frequently asked questions
Does it fix errors automatically?
No. It tells you exactly where the problem is; you make the change so nothing is silently altered.
Does formatting change the data?
No. Only whitespace changes. Key order is preserved.
Can it validate against a JSON Schema?
Not in this version; it checks syntax only.
Is my JSON stored?
No. It stays in your browser.
Guides you might like
Short, practical reads that pair with this tool.



More Developer & Code Tools
Free, in your browser, no sign-up.


