How to use it
This JSON formatter turns minified or hand-edited JSON into clean, two-space indented text and checks the syntax in the same step. If the input is invalid, you get the parser's error message with the line and column where it stopped, so you can jump to the missing comma or stray quote. Everything runs in your browser; the data you paste is not sent to a server.
How to use the JSON formatter
- Paste your JSON into the input box: an API response, a single log line or the contents of a config file.
- Click "Run tool", or press Ctrl + Enter (Cmd + Enter on macOS).
- Read the result: indented output means the JSON is valid, while an error message points to the first problem.
- Fix the reported spot in your source, run the tool again, then copy the output or download it as a text file.
What the error messages actually mean
The message comes from the browser's built-in JSON parser, so its wording depends on the browser you use. A typical one reads Expected ',' or '}' after property value in JSON at position 34 (line 4 column 3). Here position is a zero-based character offset, while line and column start at 1 and match what your code editor shows. Another engine might report the same issue as JSON.parse: expected ',' or '}' after property value in object at line 4 column 3 of the JSON data.
Keep in mind that the parser reports where it noticed the problem, not where you made it. A missing comma at the end of line 3 is only detected when the next key begins on line 4. The usual suspects:
Expected double-quoted property name: a trailing comma such as{"a": 1,}, which JavaScript tolerates and JSON does not.Expected property name or '}': single-quoted or bare keys like{'id': 1}or{id: 1}, or curly quotes pasted from a word processor or chat app.Unexpected token 'u': values that have no JSON equivalent, such asundefined,NaNor a capitalizedTrue.Bad escaped character: an unescaped Windows path such as"C:\Users\sam". Each backslash must be doubled.Bad control character in string literal: a real line break inside a string. Inside JSON strings a newline has to be written as\n.Unterminated stringorExpected ',' or ']' after array element: the text was cut off while copying, often from a truncated log viewer.
Strict JSON versus the JSON-like files you meet every day
A lot of files look like JSON but follow looser rules. The formatter applies the strict standard (RFC 8259), so it is useful to know which inputs will be rejected and why.
| Input | Typical source | Result here |
|---|---|---|
| JSONC (comments, trailing commas) | tsconfig.json, editor settings | Error at the first comment; the file is not necessarily broken |
| JSON5 (unquoted keys, single quotes) | Some build configs | Error at the first bare key |
| JSON Lines / NDJSON | Log exports, data dumps | Unexpected non-whitespace character after JSON at line 2 |
| Python dict printout | print(data) in a script | Error at the first single quote; generate it with json.dumps instead |
A single value such as "hello" or 42 | Minimal API responses | Valid; printed as is |
Side effects of a parse-and-print round trip
The tool does not re-indent your text character by character. It parses the data and prints it again, which keeps the meaning intact but can change how some values are written:
- Integers above 9,007,199,254,740,991 lose precision, so
12345678901234567890comes back as12345678901234567000. If you handle long order numbers or social media IDs, send them as strings. - Numbers are normalized:
1.50becomes1.5and1e3becomes1000. - Escapes are resolved, so
"\u00e9"prints as the actual accented letter and"\/"prints as a plain slash. - Duplicate keys collapse silently and the last value wins.
{"a":1,"a":2}prints as a single"a": 2. - Keys that look like non-negative integers, such as
"2024"or"10", move to the top of their object in ascending order. All other keys keep their original order.
Where a formatter earns its keep
- Debugging an API: paste a one-line response from the terminal and spot the field that came back
nullor the array that is unexpectedly empty. - Reading structured logs: many logging setups write each event as one line of JSON. Formatting a single line makes nested context readable.
- Reviewing config changes: validate
package.jsonor a manifest after a manual edit, before it breaks a build. - Comparing versions: format both payloads with the same indentation, then run them through the text diff checker so only real changes show up.
- Moving data on: send an array of objects to the JSON to CSV converter for a spreadsheet, or decode a token segment first with the Base64 decoder.
Privacy and limits
Formatting happens with JavaScript in your own browser tab. What you paste stays on your device; the page only increments an anonymous usage counter. That matters when a response contains access tokens, customer emails or internal hostnames. Very large inputs can make the tab pause briefly. Note that this is a syntax check, not schema validation: a missing required field or a number sent as a string will not be flagged. For a broader workflow, see the guide to working with JSON data or browse the other developer tools.