JSON Formatter & Beautifier
Format, minify and validate JSON with exact error positions, sorted keys and string escaping.
How to use the JSON Formatter & Beautifier
- 1Paste JSON, drop a .json file or load the sample.
- 2Choose Beautify or Minify, the indentation and whether keys should be sorted. The output updates as you type.
- 3If the JSON is invalid, read the error with its exact line and column, jump to it, or let Repair JSON5 fix comments, quotes and commas.
About JSON Formatter & Beautifier
The JSON Formatter & Beautifier formats, minifies and validates JSON. Paste text or drop a .json file, choose the indentation and whether object keys should be sorted, and the output updates as you type. Compact arrays keep short lists of numbers or strings on one line, and non-ASCII characters can be escaped as \u sequences for systems that only accept ASCII.
When the input is invalid, the JSON validator names the problem and its exact line and column and jumps to it. The Repair JSON5 option accepts relaxed syntax from config files and JavaScript, such as comments, trailing commas, single quotes, unquoted keys and Python's True and None, and turns it into strict JSON while listing the fixes it made. Numbers are copied exactly as written, so long IDs and prices keep every digit. A separate tab escapes any text into a JSON string literal and back.
Developers use the JSON beautifier to read API responses and log entries, minify payloads before sending them, prepare config files for review and normalize key order so diffs stay small. It is also a quick check for whether a hand-edited file is valid JSON.
Frequently asked questions
What is the difference between this and the JSON Viewer?
The JSON Formatter transforms text: beautify, minify, sort keys, repair and escape, with the result ready to copy. The JSON Viewer is for exploring: it shows large files as a collapsible tree or table and lets you copy paths to single values.
Why is my JSON invalid?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, property names without quotes, comments, and a missing comma between two values. The error message names the problem and the exact position.
Does formatting change my numbers?
No. Numbers and strings are copied exactly as written, so a 20-digit ID or a price like 10.50 is not rounded or shortened, which can happen with JSON.parse and JSON.stringify.
What does Repair JSON5 do?
It accepts relaxed syntax used in config files and JavaScript: comments, trailing commas, single-quoted strings, unquoted keys, missing commas between lines, Python's True, False and None, and NaN. The output is always strict JSON, and the tool lists every kind of fix it made.
How do I put JSON inside a JSON string?
Use the Escape string tab. It turns any text into a valid JSON string literal, escaping quotes, backslashes and line breaks, and turns such a string back into plain text.
More in Encode & Format
Encode text and files to Base64 or decode Base64 back, with URL-safe and data URI options.
Percent-encode or decode URLs and query strings, and edit every URL part in a table.
Escape text as named, decimal or hex HTML entities, or decode entities back to text.