JSON Formatter & Validator

Beautify, minify, sort and validate JSON in your browser. Errors point at the exact line.

JSON Formatter beautifies, minifies, sorts and validates JSON entirely in your browser. Paste a response from an API, a config file or a log line, and get readable indented output — or, when a document is malformed, the exact line and column where parsing failed. Nothing is uploaded, so it is safe to paste production payloads.

Mode
Indentation
JSON input
Formatted JSON

How JSON Formatter & Validator works

Formatting JSON is really two jobs: parsing and printing. The parser reads your text and either produces a JavaScript value or fails. If it fails, the failure is the useful output — a formatter that just says "invalid JSON" has wasted your time. This tool surfaces the parser's own diagnosis and, where the browser gives a character offset, converts it to a line and column so you can jump straight to the problem instead of counting characters.

Once parsed, printing is a choice about whitespace. Beautify re-emits the document with two or four spaces (or tabs) of indentation per level, which is what you want while reading or debugging. Minify emits it with none, which is what you want on the wire — for a large API payload the saving is routinely 20–30% before compression even starts. Sort keys re-emits the document with every object's keys in alphabetical order, recursively. That one is underrated: two JSON documents that are semantically identical but written in different key orders look completely different in a diff, and sorting both first makes the real differences visible.

Worth knowing about what JSON does not allow, since these are the errors people hit most: comments are not permitted, trailing commas after the last element are not permitted, keys must be wrapped in double quotes, and single quotes are never valid for either keys or strings. JavaScript object literals allow all of those, which is exactly why code pasted out of an editor so often fails to parse here.

Everything runs locally in your browser using its native JSON parser — the same one your code uses. There is no upload, no logging and no size limit beyond your device's memory, so pasting a production API response, an access token payload or a customer record carries no more risk than opening the file in a text editor.

How to use JSON Formatter & Validator

1

Paste your JSON

Drop in an API response, a config file or any JSON string. You can also open a .json file from your device.

2

Pick a mode

Beautify for readable indented output, Minify to strip every unnecessary byte, or Sort keys to make two documents comparable.

3

Copy or download

Copy the result to your clipboard in one click, or download it as a .json file.

Frequently Asked Questions

Is my JSON sent to a server?
+
No. Parsing and formatting both use your browser's built-in JSON engine. Nothing is transmitted, stored or logged, so it is safe for production payloads and anything containing customer data.
Why does my JSON say it is invalid when it looks fine?
+
The three most common causes are comments, a trailing comma after the last item, and single quotes instead of double quotes. All three are legal in JavaScript but forbidden in JSON.
What is the difference between beautify and minify?
+
Beautify adds indentation and line breaks so a human can read the structure. Minify removes every optional character so the document is as small as possible for transmission or storage. The data is identical either way.
What does "Sort keys" do and why would I want it?
+
It reorders every object's keys alphabetically, recursively. It makes two JSON documents directly comparable — without it, the same data written in a different key order produces a diff full of noise.
Is there a size limit?
+
No hard limit. Everything runs on your own device, so the practical ceiling is your available memory. Multi-megabyte documents format fine on a modern laptop, though very large ones may take a moment.
Does formatting change my data?
+
No. Only whitespace and, if you choose it, key order change. Values, types and nesting are preserved exactly. Note that JSON does not preserve duplicate keys — the last one wins, which is standard behaviour.
Can I convert the result to CSV, Excel or YAML?
+
Yes — use our CSV to JSON tool for CSV, the JSON to YAML tool for YAML, or the JSON Converter to export straight to Excel, CSV or a formatted PDF.
Is the JSON formatter free?
+
Completely free with no sign-up, no watermark and no daily limit. It costs us nothing to run because the work happens on your device.

Related tools