# JSON Formatter

> Paste JSON to pretty-print it, minify it for transport, or find exactly where it breaks. Sort keys and choose your indent.

Source: https://toffeekit.com/tools/json-formatter

**Category:** [Developer](https://toffeekit.com/category/developer) · **Price:** Free · **Runs:** in your browser, nothing is uploaded

Open the tool: https://toffeekit.com/tools/json-formatter

**Also useful for:** pretty, beautify, minify, validate, lint, api

## What you can do

- **Read an API response** — Turn a one-line response into clean, indented JSON you can scan. ([open with this preset](https://toffeekit.com/tools/json-formatter?preset=api))
- **Find the broken comma** — See the exact line and column where your JSON stops being valid. ([open with this preset](https://toffeekit.com/tools/json-formatter?preset=broken))
- **Shrink JSON for production** — Strip every space and newline before shipping a payload. ([open with this preset](https://toffeekit.com/tools/json-formatter?preset=minify))
- **Tidy a config file** — Sort keys alphabetically and indent with four spaces for clean diffs. ([open with this preset](https://toffeekit.com/tools/json-formatter?preset=config))

## How it works

1. Paste JSON into the Input box, or click Sample to see an example.
2. Choose Format or Minify, then pick an indent of 2 spaces, 4 spaces or Tab.
3. Turn on Sort keys if you want object keys in alphabetical order.
4. Check the status line for Valid JSON or the error position, then click Copy or Save.

## FAQ

### How do I format JSON online?

Paste it into the Input box and leave the mode on Format. The pretty-printed result appears on the right with syntax colors, ready to copy or save as formatted.json.

### How do I find the error in my JSON?

Paste it in and read the status line under the editors. It shows the line and column where parsing failed, for example a missing comma between two array items.

### Why is my JSON invalid when it looks fine?

The usual causes are a trailing comma, single quotes instead of double quotes, unquoted keys, or comments. Strict JSON allows none of these, so the tool reports them as errors.

### How do I minify JSON?

Switch from Format to Minify. All spaces and line breaks are removed, and the status line shows the size before and after.

### Does sorting keys change my data?

No. Sort keys reorders the keys of every object alphabetically, including nested ones. Values and the order of items inside arrays stay exactly the same.

### Is JSON Formatter free and private?

Yes. It's free with no sign-up or limits, and it runs entirely in your browser, so what you type or paste never leaves your device. It works on phones and computers alike.

## Privacy

JSON Formatter runs entirely in your browser. Your files and text are processed on your device and are never uploaded.

## Related tools

- [Base64 Encode / Decode](https://toffeekit.com/tools/base64-encoder) — Encode text to Base64 or decode it back, UTF-8 safe.
- [URL Encode / Decode](https://toffeekit.com/tools/url-encoder) — Percent-encode query values or whole URLs.
- [HTML Entities](https://toffeekit.com/tools/html-entity-encoder) — Escape < > & and quotes, or decode entities.
- [JWT Decoder](https://toffeekit.com/tools/jwt-decoder) — Read a token's header, claims and expiry.
- [Hash Generator](https://toffeekit.com/tools/hash-generator) — MD5, SHA-1, SHA-256, SHA-384 and SHA-512 at once.
- [UUID Generator](https://toffeekit.com/tools/uuid-generator) — Random v4 or time-sorted v7 UUIDs, in bulk.

