How to use the JSON Formatter
- Paste your JSON into “Your JSON”, or click “Load example” to try the tool.
- Choose the output style — 2 spaces, 4 spaces, tabs or minified. The result updates as you type.
- If the JSON is invalid, read the message under the editors and click “Show error in input” to jump to the problem.
- Copy the result, or download it as a .json file.
Examples
{"name":"Ada","skills":["math","code"],"active":true} {
"name": "Ada",
"skills": [
"math",
"code"
],
"active": true
} {"a": 1, "b": 2,} Invalid JSON: line 1, column 16 Trailing comma before "}" is not allowed in JSON.
{"id": 12345678901234567890, "price": 1.10} {"id":12345678901234567890,"price":1.10} Reading the error messages
Each message names the problem and where it is. Common ones:
- Trailing comma — a comma after the last item in an object or array, such as
{"a": 1,}. Remove it. - Is a comma missing? — two values next to each other without a comma, often after editing a line by hand.
- Property names must use double quotes — JSON requires
"key", not'key'orkey. - JSON literals are lowercase —
True,FalseandNonecome from Python; JSON usestrue,falseandnull. - Unexpected … after the end of the JSON value — the input contains two documents, or extra text after the closing bracket. Wrap several values in an array.
Columns are counted in characters as you see them, so an emoji counts as one column. “Show error in input” selects the character where the problem was found.
Indentation and minification
Two-space indentation is the most common style for JSON files and APIs. Four spaces or tabs may match your project’s editor settings. Minified JSON removes every optional space and line break, which makes it smaller to send and store but harder to read.
Related developer tools
JSON often arrives wrapped in another encoding. Decode a Base64 payload with the Base64 decoder, or a JSON value taken from a query string with the URL decoder, then paste the result here. Need IDs for test data? The UUID Generator creates as many as you need.
Common uses
- Reading API responses, log entries and configuration files that arrive on one line.
- Finding the exact cause of a “Unexpected token” error before deploying a config change.
- Minifying JSON to paste into an environment variable, a query string or a test fixture.
- Checking JSON written by hand, such as package.json or translation files.
- Spotting duplicate keys that silently overwrite each other in most parsers.
Limitations
- Only standard JSON is accepted. JSON5, JSONC, comments, single quotes and trailing commas are reported as errors, because most programs reject them too.
- The formatter does not sort keys or change values; it only changes whitespace.
- Nesting deeper than 500 levels is rejected to keep the page responsive.
- Very large documents (tens of megabytes) may be slow to paste and display on phones.