JSON formatter & validator
Paste JSON to pretty-print it, minify it or find the exact spot where it is invalid. Nothing is sent to a server.
Runs in your browser. Your files are never uploaded.
Loading JSON Formatter…
How to use JSON Formatter
- Paste your JSON into the input box, or upload a .json file.
- Choose an indent size, or press “Minify”.
- Copy the result or download it. Errors show the line and column.
What is JSON and why format it?
JSON (JavaScript Object Notation) is the most common format for sending data between servers and apps. APIs return it, configuration files use it and databases export it. To save bandwidth it is often sent as a single long line with no spaces, which is efficient for computers and almost unreadable for people.
A JSON formatter, also called a beautifier or pretty printer, re-indents the data so the structure is clear: each object and array opens a new indented level, and each key sits on its own line. A validator checks that the text follows the JSON rules, and a minifier does the reverse of beautifying, stripping whitespace to make the data as small as possible.
The most common JSON errors
If the tool reports an error, it shows the line and column of the first problem. These are the usual causes:
- Trailing comma after the last item in an object or array, e.g. {"a":1,}. JSON does not allow it.
- Single quotes instead of double quotes. JSON strings and keys must use double quotes.
- Unquoted keys such as {name: "A"}. Keys must be quoted strings.
- Comments. JSON has no comment syntax; remove // and /* */ before parsing.
- Missing commas between items, or a missing closing bracket or brace.
- Special values like undefined, NaN or Infinity, which are JavaScript values and not valid JSON.
Beautify, minify or sort?
Use beautified JSON when humans need to read or review it, such as debugging an API response or checking a config file in a code review. Use minified JSON when size matters, for example storing it in a database field or embedding it in a URL or script. Sorting keys alphabetically makes two JSON documents easier to compare, because the same data always produces the same order, which gives clean diffs in version control.
Privacy
API responses often contain tokens, emails and customer data, which makes pasting them into random websites risky. This formatter runs entirely in your browser using the built-in JSON parser. Your text is never uploaded, logged or stored.
Why use this json formatter tool
- Validate instantly. See precisely where your JSON breaks, with line and column.
- Beautify or minify. Indent with 2 or 4 spaces or tabs, or compress to one line.
- Sort keys. Optionally sort object keys alphabetically for clean diffs.
- Private. Your data stays in your browser tab.
Frequently asked questions
What is a JSON formatter?
A JSON formatter (or beautifier) adds indentation and line breaks to compact JSON so people can read it. It also checks that the JSON is valid.
Why does my JSON show an error?
Common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, none of which are allowed in JSON.
Is my JSON data sent anywhere?
No. Formatting runs locally in your browser, so API responses and private data stay on your device.
Can it handle large files?
Yes, up to what your browser's memory allows. Files of several megabytes format in well under a second on most devices.
More free tools
JSON to CSV
Convert a JSON array to CSV in your browser. Flattens nested objects, picks delimiters and downloads a ready .csv for Excel or Sheets.
Open toolCSV to JSON
Convert CSV to JSON in your browser. Auto-detects delimiter, uses the header row as keys, and can convert numbers and booleans.
Open tool