JSON Formatter
Paste JSON, get it indented, minified or validated instantly. Your data stays on this page.
Output
Paste or type above to see the result here.
Your files stay on your device
This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.
Example
Example: a package.json that will not parse, and an order webhook made readable
Two things a developer pastes in one afternoon: a package.json that the build refuses after an edit, and a one-line order payload copied from a log. Mode: Format (pretty-print), 2 spaces.
- The package.json ends with "build": "vite build", and then } — a trailing comma. The message: Expected double-quoted property name… Line 7, column 3, with a caret under the }.
- The comma to delete is at the end of line 6: the message points to where the parser gave up, one step after the mistake. Delete it and Format JSON formats the file without a message.
- The order payload is 142 characters on one line. Formatted with 2 spaces: 19 lines, 267 characters. Sort keys puts id, items, shipped, total in that order, and price, qty, sku in each item.
- Characters and bytes differ by one (267 and 268) because £ is two bytes in UTF-8. Minify gives back the 142 characters, 143 bytes.
| Pasted | What the formatter says |
|---|---|
| {'a': 1} — as Python prints a dict | Expected property name or '}'… Line 1, column 2: JSON wants double quotes |
| {"price": 12.50, "ok": True} | Unexpected token 'T'… Line 1, column 24: JSON writes true in lower case |
| [1, 2, 3,] | Unexpected token ']'… Line 1, column 10: a trailing comma |
| {"a": 1 // note} | Expected ',' or '}' after property value… Line 1, column 9: JSON has no comments |
| {"price": 12.50} | Formats as "price": 12.5 — a number loses its trailing zero |
| {"id": 9007199254740993} | Formats as 9007199254740992: past 2^53 a number loses precision |
A package.json that parses and an order you can read at a glance. For amounts where 12.50 must stay 12.50, and for IDs longer than 15 or 16 digits, send them as strings: the formatter, like any JavaScript, rewrites numbers.
How it works
- Paste your JSON into the input box. An API response, a config file, a log line, anything that should be valid JSON.
- Pick Format to pretty-print it or Minify to strip all whitespace into a single line. Choose the indentation your project uses: 2 spaces, 4 spaces or tabs.
- Turn on Sort keys if you want object keys in alphabetical order, which makes diffs and code reviews much easier to read.
- The result appears as you type. If the input is invalid, the error message tells you the line and column of the problem so you can fix it immediately.
Frequently asked questions
- What does the formatter check for?
- It checks strict JSON syntax as defined by RFC 8259: double-quoted keys, no trailing commas, no comments, no single quotes, no unquoted keys. If your text is JavaScript object notation or JSON5, it will be flagged as invalid at the first offending character.
- Does sorting keys change the meaning of my data?
- Not for objects. JSON objects are unordered by definition, so consumers must not rely on key order. Arrays are never reordered because their order is meaningful. Sorting is applied recursively to every nested object.
- Why do large numbers or Unicode strings look different after formatting?
- JSON numbers are parsed as JavaScript doubles, so integers above 2^53 (about 9 quadrillion) lose precision and very long decimals are rounded. Escaped Unicode sequences like \u00e9 are shown as the actual character. If you need exact big integers, keep them as strings.
- What is the difference between format and minify?
- Format adds line breaks and indentation so humans can read the structure. Minify removes every optional whitespace character, producing the smallest valid JSON for embedding in URLs, environment variables or network payloads. Both produce semantically identical data.
- Why does the error point to the line after my mistake?
- The position is where the parser noticed the problem, which is often one step after it. A trailing comma at the end of line 6 is reported at the } on line 7, a missing comma at the start of the next value. Look at the reported spot and just before it.
- Can it read JSON with comments, like tsconfig.json or editor settings?
- No. Those files are often JSONC, which allows // comments and trailing commas; strict JSON allows neither, so the formatter stops at the first one and says where. Remove the comments and trailing commas to format the rest.
- Is my JSON sent to a server?
- No. Parsing and formatting run with the browser's built-in JSON engine on your own device. You can paste API responses containing tokens, customer data or internal configuration without anything leaving the page.
Related tools
∿ Base64 Convert text to Base64 and back, with correct UTF-8 handling and an optional URL-safe alphabet. ♭ JWT Decoder Paste a JSON Web Token and read its header and claims. The token never leaves your browser. # Hash Generator Get the MD5, SHA-1 or SHA-2 digest of any text, computed on your device. ▤ Timestamp Converter Paste an epoch value or a date and see it in UTC, local time and ISO 8601.