JSON Formatter & Validator Online

Format, beautify, minify and validate JSON — with the exact line and column of any error. Private: runs in your browser.

Last updated:

JSON formatter and validator

API responses and config files often arrive as one long, unreadable line. Paste them here and this JSON formatter instantly beautifies them with clean indentation — or minifiesthem to a single compact line. It also validates the JSON as you type and, if something is wrong, points to the exact line and column with a plain-English explanation such as “trailing comma” or “strings must use double quotes”. Sort keys alphabetically to make documents easy to compare.

How to use it

  1. Paste your JSON in the top box.
  2. Choose 2 spaces, 4 spaces, tabs or minify; optionally sort keys.
  3. Fix any error shown, then copy or download the result.

Example

{"a":1,"b":[2,3],} is invalid because of the trailing comma before the closing brace — the validator says so and shows where. Remove it and the formatter lays it out over several readable lines. Convert JSON arrays to a spreadsheet with JSON to CSV, or compare two JSON files withtext compare.

Rate this tool

Frequently asked questions

What does a JSON formatter do?
It “pretty-prints” JSON with consistent indentation and line breaks so it’s easy to read, and checks that it’s valid. It can also minify JSON back to a single line to save space.
Why is my JSON invalid?
The most common mistakes are trailing commas after the last item, single quotes instead of double quotes, keys without quotes, and comments (JSON doesn’t allow them). The validator shows the line and column of the first error and explains it.
Is my data sent to a server?
No. Formatting and validation run entirely in your browser, so it’s safe to paste API responses, config files or data containing personal information.
What does “Sort keys” do?
It orders the keys of every object alphabetically, which makes two JSON documents much easier to compare — for example with the text compare tool.