tool
JSON Formatter, Validator & Minifier
Make JSON easier to read and work with. Format deeply nested data, validate your JSON syntax, and quickly spot problems in your data structure.
paste your code and choose format or minify
Pretty-print, validate and minify JSON
Paste an API response, a package.json, a configuration file or a log entry and make sense of it in seconds. Format JSON with two-space indentation so nested objects and arrays are easy to follow, validate it to find the exact spot where the syntax breaks, or minify it into a single line for storage and transport. The JSON is parsed with your browser's built-in JSON engine and never leaves your device.
What can you do?
- 1. Format (beautify) JSON
Expand compact JSON into an indented tree with one property per line. Ideal for reading API responses copied from the browser's network tab or a curl command. - 2. Validate JSON
Check whether the input is strictly valid JSON. When it isn't, the error message tells you what was expected and the character position where parsing failed. - 3. Minify JSON
Remove every unnecessary space and line break to produce the smallest valid JSON string, ready for an environment variable, a request body or a database field. - 4. Copy the result
Copy the output with one click and paste it into your code, Postman, a test fixture or documentation.
Why validate JSON instead of eyeballing it?
JSON looks a lot like a JavaScript object, but its rules are much stricter. A trailing comma, single quotes or a comment are fine in JavaScript and fatal in JSON, and a single mistake makes the entire document unreadable to JSON.parse(), Python's json module or any API that receives it.
A validator finds the problem immediately, which is far quicker than scanning hundreds of lines for a missing comma. Formatting then makes the structure visible so you can check that the data itself is what you expected.
How to format and validate JSON
- 1. Paste your JSON
Paste a single JSON value: usually an object { … } or an array [ … ]. - 2. Click Format, Minify or Validate
The JSON is checked first. If it's valid you get the formatted or minified output; if not, you get an error message. - 3. Jump to the reported position
The character position counts from the very start of the input, beginning at 0. The mistake is usually at that point or just before it. - 4. Copy the output
Copy the clean JSON and use it wherever you need it.
Common JSON syntax errors and how to fix them
Nearly every invalid JSON document fails for one of these reasons. The reported character position usually lands right on, or just after, the mistake.
| Mistake | Invalid example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} | Delete the comma after the last item. |
| Unquoted or single-quoted key | {a: 1} or {'a': 1} | Wrap keys in double quotes: {"a": 1}. |
| Missing comma | {"a": 1 "b": 2} | Add a comma between properties. |
| Comment in the data | {"a": 1 /* note */} | Remove comments; JSON doesn't support them. |
| JavaScript-only values | {"a": undefined}, NaN, Infinity | Use null, a number or a string instead. |
| Raw line break inside a string | "first line⏎second" | Escape it as \n. |
| Two JSON values one after another | {"a":1}{"b":2} | Wrap them in an array: [{…}, {…}]. |
What formatting and minifying can change
The tool reads your JSON into memory and writes it back out, which follows the JSON standard but can surprise you in a few edge cases:
- Very large integers lose precision
Numbers above 9,007,199,254,740,991 can't be represented exactly in JavaScript, so an ID like1234567890123456789comes back as1234567890123456800. If your data contains 64-bit IDs, store them as strings. - Duplicate keys collapse to the last value
{"a": 1, "a": 2}becomes{"a": 2}. A duplicate key is usually a bug, so it is worth checking where it came from. - Number formats are normalised
1.0is written as1and1e3as1000. The values are identical; only the notation changes. - Unicode escapes are decoded
An escaped character such aséis written as the character itself (é). This is still valid JSON.
Frequently asked questions
Can I change the indentation to 4 spaces or tabs?
Formatted output always uses two-space indentation, which is the most common convention for JSON in web projects and keeps deeply nested data readable.
Does the formatter fix invalid JSON automatically?
No. It tells you what is wrong and where, and leaves the fix to you, so your data is never changed in ways you didn't intend.
Can I format JSON Lines (NDJSON) or several objects at once?
Not directly. The tool expects one JSON value. Wrap multiple objects in square brackets and separate them with commas to turn them into a single valid array.
Is JSON with comments (JSONC) supported?
No. Files like tsconfig.json or VS Code settings allow comments, but standard JSON does not. Remove the comments before formatting.
Is it safe to paste API responses that contain private data?
The JSON is processed entirely in your browser and is not uploaded, logged or stored by Buggerspot. As a general habit, still avoid pasting live secrets such as access tokens into any website.
Related tools
Need to do more with your data? Convert it to a spreadsheet with the JSON to CSV converter, generate types with the JSON to TypeScript tool, or format two responses and compare them in the diff checker.
- JSON to CSV Converter – Convert JSON arrays to CSV and CSV back to JSON.
- JSON to TypeScript Converter – Generate interfaces and types from JSON, or JSON from types.
- YAML Formatter & Validator – Fix YAML indentation and find syntax errors in config files.
- Diff Checker – Compare two versions of text or code line by line.
- Secure Token Generator – Create random secrets, API keys, UUIDs and hex strings.