JSON Formatter and Validator
Paste JSON to beautify, minify or check it. Errors show the exact line and column. Nothing leaves your browser.
What this tool does
Format (also called pretty print or beautify) adds line breaks and indentation so JSON is easy to read. Minify removes all unnecessary whitespace to make it as small as possible for sending over a network. Validate checks that the text is valid JSON and, if not, tells you exactly where the problem is and selects that character in the input.
Everything runs in your browser. Your data is not uploaded, stored or logged, so it is safe to paste private payloads. Press Ctrl+Enter in the input box to run the default action.
Common JSON mistakes
- Trailing commas:
{"a":1,}is not allowed in JSON, even though JavaScript allows it. - Single quotes: keys and strings need double quotes.
{'a':1}is invalid. - Unquoted keys:
{a:1}is invalid. Write{"a":1}. - Comments: JSON has no comments. Remove
//and/* */. - Special values:
NaN,Infinityandundefinedare not valid. Usenull. - Line breaks in strings: a string cannot contain a raw new line. Write
\n. - Missing commas or brackets: the error message points to where the parser lost track, which is often just after the real mistake.
Common HTTP status codes in API responses
| 200 OK | The request worked and the response has the result. |
| 201 Created | A new resource was created, often after a POST. |
| 204 No Content | Success with nothing to return, common after a DELETE. |
| 400 Bad Request | The server could not understand the request. Malformed JSON is a frequent cause, so validate your body here. |
| 401 Unauthorized | Missing or invalid credentials. |
| 403 Forbidden | You are identified but not allowed to do this. |
| 404 Not Found | The resource or URL does not exist. |
| 405 Method Not Allowed | The URL does not support that method, for example POST to a read-only endpoint. |
| 409 Conflict | The request conflicts with the current state, such as a duplicate. |
| 415 Unsupported Media Type | The Content-Type header is not one the server accepts. For JSON send application/json. |
| 422 Unprocessable Content | The JSON is valid but its values fail the server's rules. |
| 429 Too Many Requests | You hit a rate limit. Wait and retry, often as the Retry-After header says. |
| 500 Internal Server Error | The server failed unexpectedly. |
| 502 Bad Gateway | A gateway or proxy got an invalid response from the server behind it. |
| 503 Service Unavailable | The server is overloaded or down for maintenance. |
| 504 Gateway Timeout | A gateway or proxy waited too long for the server behind it. |
Frequently asked questions
Is my JSON uploaded anywhere?
No. Formatting and checking happen entirely in your browser.
Why did a long number change?
Browsers store JSON numbers as 64-bit floating point numbers, which are exact only up to about 15 digits. Whole numbers with 16 or more digits, such as some IDs, can be rounded. The tool warns you when it sees one. If exact IDs matter, keep them as strings.
What does Sort keys do?
It orders object keys alphabetically at every level, which helps when comparing two JSON documents. Arrays keep their order.
Is there a size limit?
There is no fixed limit, but very large documents (many megabytes) depend on your device's memory and may be slow.