JSON Formatter
Paste JSON to validate it, pretty-print it with a 2-space indent or minify it to one line. Errors show their line and column, repeated keys are flagged, and numbers keep their exact digits.
Input JSON
Try sample JSON:
Formatted JSON
Formatted JSON will appear here...
Usage tips
- Format: Pretty-print JSON with a 2-space indent
- Minify: Remove all whitespace to reduce file size
- Validate: JSON is checked as you type. Errors show the line and column when your browser reports them
- Numbers keep the exact digits you pasted: 1e400, -0, 1.50 and long IDs are not rounded or rewritten
- A key used twice in the same object gets a warning, because most parsers keep only the last value
How to format and validate JSON
- Paste JSON into the input box, or click a sample to see how it works. It is checked as you type.
- If it is invalid, read the message under the box and go to the line and column it names. Fix that spot and the error clears on its own.
- Pick Format to indent it for reading, or Minify to strip the whitespace for sending or storing.
- Copy the result, or download it as formatted.json or minified.json. To read the JSON inside a token, use JWT Decoder.
Frequently asked questions
How do I check if my JSON is valid?
Paste it in and look under the box: it says Valid JSON, or Invalid JSON with the error message and, when your browser gives one, the line and column. The check uses your browser's own JSON parser, the same one web apps use, so JSON that passes here will parse in a browser.
Why is my JSON invalid when it looks fine?
The usual causes are a comma after the last item, single quotes instead of double quotes, keys without quotes, comments, or values like undefined and NaN. JavaScript code allows all of these, but the JSON grammar in RFC 8259 does not.
Sources: IETF, RFC 8259: The JSON data interchange format
Does formatting change my numbers?
No. Every number is printed exactly as you wrote it, so 0.10 stays 0.10 and a 19-digit ID keeps all its digits. Integers beyond 9,007,199,254,740,991 get a warning, because RFC 8259 notes that only integers up to that size are safe to exchange and many tools round larger ones.
Sources: IETF, RFC 8259: The JSON data interchange format
Are duplicate keys removed?
No. The formatter prints your JSON as written, so both copies of a repeated key stay. RFC 8259 says keys should be unique, and most parsers, JavaScript's included, keep only the last value, so rename or remove one of them.
Sources: IETF, RFC 8259: The JSON data interchange format
What is the difference between formatting and minifying?
Format adds line breaks and 2-space indents so people can read it. Minify removes every space and line break outside strings, which makes the text smaller for an API request or storage. The data is the same either way.
Is it safe to paste API responses here?
Yes. Checking and formatting run in your browser and nothing is uploaded or saved. That makes it fine for responses that hold tokens, emails or customer records.