JSON Formatter
Format, validate, and minify JSON instantly in your browser — no upload, no signup.
Masukan JSON
JSON yang diformat
Masukkan JSON di sebelah kiri untuk memformatnya.
Apa itu JSON Formatter?
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format defined in RFC 8259 that uses human-readable structures of objects and arrays to represent data. A JSON formatter parses raw or minified JSON and re-emits it with consistent indentation and line breaks so the structure is easy to read and mistakes are easy to spot. Because it uses a strict parser, it also surfaces syntax errors — trailing commas, single-quoted strings, and unquoted keys are valid in JavaScript object literals but rejected by JSON — with the exact line and column where parsing failed. The same operation can minify the input, stripping all non-essential whitespace to produce the smallest possible payload for network transfer.
Cara menggunakan JSON Formatter
- Paste or type your raw JSON into the input box on the left — or drag a .json file straight onto it.
- Choose an indent width (2 or 4 spaces, or a tab) from the dropdown.
- The formatted, syntax-validated output appears instantly on the right — no button click needed.
- Click "Copy" to copy the formatted JSON, or switch to "Minify" mode to collapse it to a single line.
Contoh
Compact to pretty
Masukan
{"name":"Ada","active":true,"roles":["admin","user"]}
Keluaran
{ "name": "Ada", "active": true, "roles": [ "admin", "user" ] }
Nested objects
Masukan
{"user":{"id":1,"address":{"city":"Berlin"}}}
Keluaran
{ "user": { "id": 1, "address": { "city": "Berlin" } } }
Minify mode
Masukan
{ "a": 1, "b": 2 }
Keluaran
{"a":1,"b":2}
Kesalahan umum
- Leaving a trailing comma after the last property in an object or the last item in an array — valid in JavaScript, invalid in JSON.
- Using single quotes ('like this') instead of double quotes ("like this") for strings and keys.
- Forgetting to quote object keys — JSON requires every key to be a double-quoted string, unlike JavaScript object literals.
- Mixing up JSON with JSONC/JSON5 (which allow comments and trailing commas) and expecting a strict JSON parser to accept them.
Mengapa menggunakan alat ini
- Runs entirely client-side — safe for sensitive API responses, tokens, or internal config that you don't want touching a third-party server.
- Instant feedback with precise line/column error reporting, rather than a generic "invalid JSON" message.
- No installation, account, or rate limit — unlike CLI tools (jq) or IDE-only formatters, it works from any device with a browser.
- Combines formatting, minifying, and validation in one tool instead of three separate utilities.