JSON Validator
Check whether text is valid JSON and get a compact minified copy when it is. Strict RFC 8259 parsing, runs in your browser.
Calculator by Toolsloft ↗Valid JSON
Check whether a block of text is valid JSON and get a clear yes or no. When it is valid, the tool also returns a compact, minified copy you can reuse. When it is not, it tells you so, and the page shows the parser error to help you find the problem. Everything runs in your browser.
How this is calculated
The input is parsed with a strict JSON parser that follows RFC 8259, so trailing commas, single-quoted strings, comments, and bare NaN or Infinity are all treated as invalid. Valid input is re-serialized with no extra whitespace, keeping object keys in their original order.
How to use
- Paste your JSON into the input box.
- See whether it is valid, with the parser error shown when it is not.
- Copy the minified output when the JSON is valid.
Examples
- Valid:
[1, 2, 3] is valid, minified to [1,2,3] - Invalid:
{'single':1} is not valid JSON
FAQ
- Why is my JSON with single quotes invalid?
- JSON requires double quotes around strings and object keys. Single quotes are common in JavaScript object literals but are not valid JSON, so a value like {'single':1} fails validation.
- Are trailing commas allowed?
- No. A trailing comma after the last item in an array or object is not valid JSON, even though many programming languages accept it. Remove it and the JSON will validate.
- What does the minified output do?
- It re-serializes valid JSON with no spaces or line breaks, which is the smallest form for storage or transport. Object keys keep their original order.