Utilities

JSON Formatter & Validator

Format & Validate

Format Your JSON

Paste your JSON or upload a file to format, validate, and minify. Get detailed error messages with line numbers.

Indentation:

2 spaces
4 spaces

💡 JSON Formatting Tips

JSON is automatically validated and formatted as you type. Use the minify button to compress JSON, or adjust indentation for readability.

Tool features

Comprehensive JSON formatting, validation, and optimization tools
4 features

JSON Validation

Validate JSON syntax with detailed error messages and line numbers

Beautify & Format

Format JSON with customizable indentation for better readability

Minify JSON

Compress JSON by removing whitespace to reduce file size

Error Detection

Identify syntax errors with precise line and column numbers

What is JSON formatting & how it works

Making machine-friendly JSON readable, and back

JSON (JavaScript Object Notation) is the text format most APIs, config files and logs use to exchange structured data: objects in braces, arrays in brackets, and strings, numbers, booleans and null as values. It is strict: keys must be double-quoted, and trailing commas and comments are not allowed.

Formatting (pretty-printing) adds indentation and line breaks so nested data is readable; minifying strips all whitespace to make payloads smaller. Both start by parsing the JSON, so this tool also acts as a validator and points to the line where parsing failed. Everything runs in your browser.

Beautify
Re-indents JSON with 2 or 4 spaces for reading and diffs.
Minify
Removes all insignificant whitespace to shrink the payload.
Validate
Parses the text strictly and reports the first syntax error it hits.

How to use this tool

Format and validate JSON in four steps
1
Add your JSON
Paste JSON into the input or upload a .json file.
2
Format or minify
Choose Beautify with your preferred indentation, or Minify for the smallest output.
3
Fix any errors
If the JSON is invalid, jump to the reported line and fix the syntax.
4
Copy or download
Copy the result or download it as a file.

Frequently asked questions

Common questions about JSON formatting
5 Q&A

The usual culprits are single quotes instead of double quotes, unquoted keys, a trailing comma after the last item, comments, or an unescaped control character inside a string. The error message shows where parsing stopped.

No. Standard JSON has no comment syntax. Formats such as JSONC and JSON5 allow them, but a strict parser will reject them.

No. Beautifying and minifying only change whitespace between tokens; keys, values and their order stay exactly the same.

No. Parsing, formatting and validation all happen in your browser, so it is safe to paste API responses and config files.

Use jq . file.json, or python3 -m json.tool file.json if jq is not installed.