Developer tools · Data Formats
JSON Formatter
Format, validate, and minify JSON online. Pretty-print with 2/4 spaces or tabs, minify for compact storage, and see exact error line/column for invalid JSON.
How it works
Formats, minifies, and validates JSON. Pretty-print with configurable indentation, minify for compact storage, or validate structure and report the exact line and column of any syntax error.
Step by step
- 1Paste your JSON into the input field.
- 2Choose Format to pretty-print, Minify to compact, or Validate to check syntax.
- 3For formatting, select 2 spaces, 4 spaces, or tab indentation.
- 4Errors show the line and column number of the problem.
Examples
Format JSON
Adds newlines and 2-space indentation.
Inputs
- action:
- format
- indent:
- 2
- input:
- {"name":"Alice","age":30}
Result
- output:
- { "name": "Alice", "age": 30 }
- status:
- Valid JSON
Minify JSON
Removes all whitespace.
Inputs
- action:
- minify
- indent:
- 2
- input:
- { "name": "Alice", "age": 30 }
Result
- output:
- {"name":"Alice","age":30}
- status:
- Valid JSON
Frequently asked questions
How do I fix a JSON syntax error?▾
The formatter reports the exact line and column where the error was found. Common mistakes: missing quotes around keys, trailing commas, using single quotes instead of double quotes.
What is the difference between formatting and minifying?▾
Formatting adds indentation and newlines to make JSON human-readable. Minifying removes all unnecessary whitespace to reduce file size, which is useful for API responses and storage.