# JSON formatter and validator

URL: https://shahid09.is-a.dev/tools/json-formatter/
Author: Muhammad Shahid (https://shahid09.is-a.dev/)
Free tool · runs in your browser

Paste JSON to format it with readable indentation, minify it to one line, or find exactly where it is broken.

**Quick answer:** Paste your JSON and choose Format for readable, indented output or Minify to remove all whitespace. If the JSON is invalid, the tool shows the error message from the browser's own JSON parser, which points at the problem, such as a trailing comma or a missing quote.

## How to use it

1. **Paste your JSON.** From an API response, a config file or a log.
2. **Format or minify.** Format adds indentation (2 spaces, 4 spaces or tabs); minify puts it on one line.
3. **Fix any errors.** If it is invalid, read the error, fix that spot and try again.

## Frequently asked questions

### What are the most common JSON errors?

Trailing commas after the last item, single quotes instead of double quotes, unquoted keys, and comments, which JSON does not allow.

### Is my JSON sent to a server?

No. Formatting and validation run in your browser.

### What is the difference between formatting and minifying?

Formatting adds line breaks and indentation for people to read; minifying removes them to make the data as small as possible for sending.

### Can JSON have comments?

No. Standard JSON does not allow comments; remove them or use a format such as JSONC that your tool supports.

### How large a JSON file can I format?

Several megabytes work fine in a modern browser; very large files may be slow because everything runs on your device.

### What is the difference between JSON and a JavaScript object?

JSON is a text format with stricter rules: keys and strings in double quotes, no trailing commas, no comments, and no functions or undefined values.

### How do I format JSON in JavaScript?

JSON.stringify(value, null, 2) formats with two-space indentation, and JSON.parse(text) reads JSON into an object.

### Why does my JSON have escaped quotes like \"?

It was probably encoded twice: a JSON string inside JSON. Parse it once more to get the object.

### Can JSON contain dates?

Not as a type. Dates are usually stored as ISO 8601 strings, such as "2026-10-31T12:00:00Z", or as Unix timestamps.

### What is JSON Lines?

A format with one JSON object per line, common for logs and data exports. Format each line separately.

## Related

- [Base64 encoder and decoder](https://shahid09.is-a.dev/tools/base64-encoder-decoder/)
- [JWT decoder](https://shahid09.is-a.dev/tools/jwt-decoder/)
- [Scaling a Node.js API from 200K to 1M users](https://shahid09.is-a.dev/engineering/scaling-nodejs-api-200k-to-1m-users/)
