JSON Formatter & Validator

Paste JSON in the left box, then click Format to beautify it. Click Minify to compress it onto one line. Errors are shown with the offending line number.

Features

Format & beautify JSON
Validate JSON syntax
Minify JSON
Syntax highlighting
Error line detection

How to Use

1. Paste your JSON into the input box on the left.

2. Choose an indentation (2 spaces / 4 spaces / Tab).

3. Click Format to beautify, or Minify to compress.

4. Click the Copy button to copy the result.

About this tool

JSON is the default language of APIs, configuration files and logs, and it is unforgiving: one trailing comma or unquoted key makes the whole document invalid. This formatter parses your JSON with the browser's strict JSON parser, reports the line where parsing failed, and pretty-prints valid data with two spaces, four spaces or tabs. The result is shown as a collapsible tree, so you can fold large arrays and objects and expand them all again with one click. Minify removes all optional whitespace for compact payloads. Copy the output or download it as a file, or drag a .json file straight onto the input. Documents over a megabyte show a processing indicator while they are parsed.

Frequently Asked Questions

Why is my JSON invalid when it works in JavaScript?
JSON is stricter than JavaScript objects. Keys must be in double quotes, strings cannot use single quotes, trailing commas are not allowed, and comments, undefined, NaN and functions are not valid JSON values.
How do I find the error in a long JSON file?
The tool reports the line near where the parser stopped. The actual mistake is often just before that point, such as a missing comma at the end of the previous line or an unclosed bracket further up.
Does formatting change my data?
No. Keys, values and their order are kept. One detail to know: integers larger than 9,007,199,254,740,991 lose precision in JavaScript, so very long numeric IDs should be stored as strings.
What is the difference between Format and Minify?
Format adds indentation and line breaks for people to read. Minify removes every optional space and newline, producing the smallest valid JSON for storage or network transfer. Both represent exactly the same data.
Can it handle JSON Lines or JSON with comments?
No. JSON Lines files contain one JSON value per line, and JSONC or JSON5 allow comments and trailing commas; neither is standard JSON. Format one line at a time, or remove the comments first.

Related Tools