DevPocket
JSON formatter and validator
Paste some JSON and you will know instantly whether it is valid. If it is not, the formatter points to the exact line and column and explains the problem in plain words: a trailing comma, single quotes, a comment or an unclosed brace.
Whatever you paste into DevPocket is processed in your browser and is neither stored nor sent.
Loading the tool…
When the JSON is valid it is shown with your preferred indentation (2 or 4 spaces, or tabs) and, optionally, with keys sorted alphabetically so objects are easy to compare. It also warns you about numbers too large for JavaScript.
How to use it
- Paste the JSON into the input box or load the example.
- If there is an error, fix it at the line shown.
- Choose the indentation and whether to sort keys, then copy the result.
Frequently asked questions
Why does JSON not allow trailing commas or comments?
The JSON standard (RFC 8259) is deliberately strict so every language reads it the same way. Formats such as JSON5 or JSONC allow them, but they are not valid JSON for most APIs.
What about very large numbers?
JavaScript only represents integers exactly up to 2^53 − 1 (about 16 digits). If your JSON contains longer identifiers, the tool warns you: store them as strings instead.
Limitations
- Regular expressions use the JavaScript engine; syntax may differ from PCRE, Python or Java.
- The text diff is designed for documents up to about 2 MB.