Format, validate, and beautify JSON with syntax highlighting
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write and easy for machines to parse and generate. The JSON Formatter helps format, validate, minify, and clean JSON payloads.
Paste your JSON into the input box and the tool parses it immediately. Valid JSON is shown as a collapsible tree and as formatted text, while invalid JSON shows an error so you can find the problem. You can pick a 2 or 4 space indent and copy or download the result.
Switch to the Minified tab, or use the minify action, to remove all spaces and line breaks from valid JSON. The data itself is unchanged, only the whitespace is removed, which makes the text smaller for APIs, config files or URLs.
The most common causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, comments, and curly smart quotes pasted from a document. JSON requires double quotes for every key and string. The repair button fixes smart quotes and trailing commas for you.
Yes. Turn on the sort keys option and object keys are ordered alphabetically at every level of nesting in the formatted and minified output. Arrays keep their original order. This is handy for comparing two JSON documents or producing stable diffs.
JSON is a strict text format, while a JavaScript object literal is code. JSON needs double-quoted keys and strings and does not allow comments, trailing commas, undefined, functions or single quotes. Text that works in JavaScript source often fails JSON validation for these reasons.
Yes. Use the upload button to load a .json file from your device into the editor, then format, search the tree or minify it. The file is read by your browser and is not sent to a server. Very large files can be slow to render as a tree because every node is drawn.
No. All validation and formatting happen locally in your browser using pure client-side JavaScript. No data is transmitted externally.
Common mistakes include trailing commas, single quotes instead of double quotes, or missing quotes around property keys. The validator highlights these errors with line numbers.
Formatted JSON includes spacing, line breaks, and indentation for human readability. Minified JSON strips out all whitespace and newlines to create the smallest possible file size for server transmission.
Never. Your data is formatted entirely inside your browser tab using client-side JavaScript.