JSON Formatter

Format, validate and minify JSON in your browser, with clear error messages that point to the exact line.

Runs in your browser — nothing is uploaded
Options
Example

About the JSON Formatter

API responses, config files and log entries often arrive as one long unreadable line of JSON. This free JSON formatter turns them into neatly indented, readable text, or minifies them back to the smallest size for sending. It checks the JSON as you type. When something is wrong, it shows the exact line and column with a short explanation, such as a trailing comma, a missing quote, single quotes instead of double quotes, or a comment, which JSON doesn’t allow.

The formatter keeps your data exactly as written. Very large numbers, such as 64-bit IDs, are not rounded, and string escapes are left untouched. You can choose 2 spaces, 4 spaces or tabs, and sort object keys alphabetically to make two JSON files easier to compare. Everything runs inside your browser, so API keys, tokens and customer data in your JSON never leave your computer.

How to use the JSON Formatter

  1. Paste your JSON into the left box, or press “Load sample JSON” to try it.
  2. Check the message under the boxes: it says “Valid JSON” or points to the error.
  3. Choose an indent and, if you like, sort keys, then press Format (or Minify).
  4. Copy the result or download it as a .json file.

Common JSON errors and how to fix them

WrongRightWhy
{"a": 1,}{"a": 1}No comma after the last item
{'a': 'x'}{"a": "x"}Strings and keys need double quotes
{a: 1}{"a": 1}Keys must be quoted
{"a": 1 // note}{"a": 1}JSON has no comments
{"a": undefined}{"a": null}Only null, true, false, numbers, strings, arrays and objects
{"n": 012}{"n": 12}Numbers can’t start with 0 (except 0 itself and 0.5)

Format vs minify

Formatted (2 spaces)Minified
Looks like{
  "id": 7,
  "ok": true
}
{"id":7,"ok":true}
Use forReading, debugging, code reviewsSending over a network, storing, embedding

Frequently asked questions

How do I find the error in my JSON?

Paste it in the left box. If it’s invalid, the message shows the line and column, a preview of that line with a marker under the problem, and a short hint such as “trailing comma” or “use double quotes”. Press “Jump to error” to select that spot in the box.

Will formatting change my numbers or text?

No. Values are copied exactly as written, including very large numbers that some tools round off, and escaped characters like \n or \u00e9. Only spaces and line breaks between values change.

Is my JSON sent to a server?

No. Parsing and formatting happen in your browser on your own device, so it’s safe to paste API responses that contain tokens, emails or other private data.

Can it handle large JSON files?

Yes. Files of several megabytes format in a moment on most computers. Very large files (50 MB and up) depend on your device’s memory and may be slow to display.

Last updated: