# JSON Formatter

URL: https://tools.otaku-dojo.com/en/json-formatter
Updated: 2026-10-03

The JSON Formatter turns minified or messy JSON into cleanly indented, readable JSON and validates it at the same time — when something is wrong it tells you the exact line and column. It can also minify JSON to a single line, sort object keys alphabetically or show a collapsible tree view. Everything runs in your browser, so your data is never uploaded.

## How to use the JSON Formatter

1. Paste JSON into the "JSON" box on the left, or press "Sample" to load example data.
2. Choose the indentation (2 spaces, 4 spaces or Tab) and the mode (Beautify or Minify); turn on "Sort keys" if needed.
3. The result updates instantly on the right. If the JSON is invalid, the status bar shows the line and column of the error.
4. Press "Copy" to paste it back into your code, or "Download" to save a .json file.

## Specs & key facts

- **Standard**: RFC 8259 / ECMA-404
- **Processing**: In your browser (nothing is uploaded)
- **Indentation**: 2 spaces, 4 spaces, Tab
- **Other features**: Minify, sort keys alphabetically, tree view, error line and column
- **File size**: Up to about 10 MB, depending on device memory
- **Price**: Free, no sign-up

## Examples: Pretty-print one-line JSON with 2-space indentation

```json
{"id":1024,"name":"Otaku Dojo","tags":["json","tools"],"active":true}
```

→

```json
{
  "id": 1024,
  "name": "Otaku Dojo",
  "tags": [
    "json",
    "tools"
  ],
  "active": true
}
```

## Examples: Find a syntax error: trailing comma

```json
{
  "a": 1,
  "b": 2,
}
```

→

```json
Syntax error near line 4, column 1: trailing commas are not allowed
```

## FAQ

### What is the difference between formatting and validating JSON?

Formatting re-indents JSON so it is easy to read; validating checks that the syntax is correct. This tool validates first and only outputs a result when the JSON is valid, otherwise it shows where the error is.

### Why does it report an error at line X, column Y?

That is where the parser first met an invalid character. The real mistake is often just before it — a missing or extra comma, or an unclosed quote.

### Can it format JSON with comments (JSONC)?

No. Standard JSON does not allow comments; remove // and /* */ comments before pasting.

### Does sorting keys change my data?

No. Only the order of keys inside objects changes; values and array order stay the same, and JSON objects are unordered by definition.

### Is it safe to paste production API responses?

Yes. Formatting runs entirely in your browser and the content is never sent to a server.
