JSON Formatter & Validator
Pretty-print JSON with 2 or 4 spaces, minify it, or check that it is valid. Errors show the exact line and column with a plain explanation.
Runs in your browser. Your data is not uploaded.How our tools work
How do I format and validate JSON?
Paste your JSON and select Format to indent it with 2 or 4 spaces, Minify to remove all whitespace, or Validate to check it. Invalid JSON shows what is wrong with its exact line and column, such as a trailing comma or a missing quote. Numbers and text are kept exactly as written, and nothing is uploaded.
- Paste or type your JSON into “Your JSON”.
- Choose the indentation: 2 spaces, 4 spaces or a tab.
- Select Format to pretty-print it, Minify to put it on one line, or Validate to check it without changing it.
- If the JSON is invalid, read the message and select “Show the error in my JSON” to jump to the problem. Otherwise, copy the result.
New to JSON, or keep hitting the same error? Read our guide: JSON Syntax Errors Explained, and How to Fix Them
Key features
Format, minify and validate
Pretty-print with 2 spaces, 4 spaces or tabs, compress to a single line, or just check that the JSON is valid.
Exact error location
Errors show the line and column and a plain explanation, such as a trailing comma, single quotes, a comment or a missing comma.
Your data kept exactly
Only whitespace changes. Large numbers, decimals like 1.10, escapes and duplicate keys stay as you wrote them, unlike formatters that parse and re-save the data.
Duplicate key warning
Flags keys that appear twice in the same object, which many programs silently reduce to one.
Common uses
- Read an API response or log entry that arrives on one line
- Find the error in a configuration file that won’t load
- Shrink JSON before putting it in a request, URL or database field
- Check JSON you wrote by hand before sending it to someone else
Supported formats and limits
- Input
- Standard JSON (RFC 8259): objects, arrays, strings, numbers, true, false and null at any depth
- Not accepted
- Comments, trailing commas, single quotes, unquoted keys, NaN and Infinity, which JSON doesn’t allow
- Output
- Pretty-printed with 2 spaces, 4 spaces or tabs, or minified
Common JSON errors
Most invalid JSON comes from a handful of mistakes, often from copying JavaScript or a configuration file:
- A comma after the last item: {"a": 1,} or [1, 2,]
- Single quotes instead of double quotes: {'name': 'value'}
- Keys without quotes: {name: "value"}
- Comments, which JSON doesn’t support
- A missing comma between two items, or a missing closing } or ]
- A line break inside a string instead of \n
Why the numbers don’t change
Many formatters read the JSON into JavaScript and write it out again. That quietly rounds whole numbers above 9,007,199,254,740,991, turns 1.10 into 1.1, and keeps only the last of two identical keys. This tool reads the text itself and only changes the spaces and line breaks between values, so the data you get back is exactly the data you put in.
Related tools
Frequently Asked Questions
What is the difference between formatting and minifying?
Formatting adds line breaks and indentation so JSON is easy to read. Minifying removes all unnecessary whitespace to make it as small as possible. Both keep the data the same.
Does it tell me where the error is?
Yes. Invalid JSON shows the line and column of the problem with a plain explanation, and a button that selects that spot in your text.
Why is my JSON with comments invalid?
Standard JSON doesn’t allow comments or trailing commas. Some tools accept them as extensions, such as JSONC or JSON5, but APIs and browsers expect standard JSON.
Will formatting change my numbers?
No. Numbers, strings and escapes are copied exactly, including very large integers that JavaScript would round.
Is my JSON uploaded or logged?
No. It is processed in your browser and never uploaded or stored. Analytics, if you allow them, only record that a button was used, never your JSON.
Sources
Last updated:
Related guides & tutorials
JSON Syntax Errors Explained, and How to Fix Them
JSON syntax explained with valid and invalid examples: formatting vs minifying, indentation, and how to fix trailing commas, single quotes and other errors.
How to Encode and Decode Base64, and What It’s For
How Base64 turns data into text, why it ends in = signs, where it’s used, how to encode and decode it, and why Base64 is encoding, not encryption.