JSON Validator: Check JSON Syntax Online
How a JSON validator and formatter works, what it can change beyond whitespace, common syntax errors, and copy, paste and privacy limits to check before use.
A JSON validator answers one question: does this text follow JSON syntax? Most online tools that call themselves a JSON checker, syntax checker or JSON tester also format the input, either by pretty-printing it with indentation or by minifying it into a single line. This review explains what those two operations do to your data, where a formatter can quietly change more than layout, and what to check before you paste a result back into a config file, API request or codebase.
Is a JSON formatter and validator suitable for your use?
For finding syntax errors and making nested data readable, yes. The main benefit is speed: a parser locates a missing comma or stray quote faster than reading by eye, and indentation exposes structure that is hard to see in a minified payload. The decisive tradeoff is that many formatters parse your JSON into in-memory values and then write it back out, rather than editing the original text. For ordinary data that round trip is harmless. For very large integers, duplicate keys, exact number spelling or deliberate escape sequences, the output can differ from the input in ways that matter. Keep the original text, and treat the formatted copy as a reading aid, when the exact bytes are significant, such as signed payloads, hashed content, test fixtures compared byte for byte, or values that a downstream system reads as text.
What validation checks and what formatting changes
Validation is read-only. The tool runs a JSON parser over the input and reports either success or the first point where parsing failed. Nothing about your data changes.
Formatting rewrites the text. JSON allows insignificant whitespace (spaces, tabs, line feeds and carriage returns) between tokens, so adding indentation or removing it does not change the data a parser sees. Here "format" means layout only. It is unrelated to fonts or Unicode character styling: a JSON formatter does not substitute characters inside your strings, and if a tool did, the string values would no longer be the same data.
Most syntax errors come from habits carried over from JavaScript, Python or hand-edited config files. The common ones are:
- Single-quoted strings or keys; JSON requires double quotes.
- Unquoted keys; every object key must be a double-quoted string.
- Trailing commas after the last item in an object or array.
- Comments of any kind; standard JSON has no comment syntax.
- Capitalized or language-specific literals such as True, False, None or undefined; JSON uses lowercase true, false and null.
- Numbers with leading zeros, a leading plus sign, NaN or Infinity.
- Unescaped control characters, such as a literal tab or line break, inside a string.
- More than one top-level value in one document, as in JSON Lines files checked as a single document.
The following input contains five of those errors:
{
'name': "Ada",
"active": True,
"tags": ["a", "b",],
// owner note
"count": 007
}
A corrected version that a strict parser accepts:
{
"name": "Ada",
"active": true,
"tags": ["a", "b"],
"count": 7
}
The fix had to drop the comment. If that comment carried information someone needs, it has to move into a data field or a separate document. A validator cannot preserve it. Minifying the corrected version gives the same data with the whitespace removed:
{"name":"Ada","active":true,"tags":["a","b"],"count":7}
Where formatting can change more than whitespace
When a formatter parses and re-serializes, the parser's data model decides what comes out. The cases below follow from how JavaScript's built-in JSON handling behaves, which browser-based tools often use. Unless a specific tool's documentation says otherwise, check these yourself on a sample.
| Input feature | What a parse-and-rewrite formatter may do | What to check |
| Large integers, e.g. 12345678901234567890 | Stored as a double-precision float and written back as 12345678901234567000 | Compare long IDs and counters before and after |
| Number spelling, e.g. 1.0 or 1e2 | Rewritten as 1 or 100; same value, different text | Matters only if something compares the text |
| Duplicate keys, e.g. {"a":1,"a":2} | Only one survives, often the last; the JSON standard calls behavior with non-unique names unpredictable | Whether your input has duplicates at all |
| Escape sequences, e.g. \u00e9 or / | Written back as é or / | Whether a consumer expects the escaped form |
| Key order | Usually preserved, but some tools offer or default to sorting | Any sort option, and whether order matters downstream |
Tools that only re-indent the original text, without rebuilding it from parsed values, avoid these changes. Few tools say which approach they use, so the safe test is a before-and-after comparison on input that contains a long integer and a duplicate key.
Valid syntax is not the same as correct data
A syntax checker confirms that the text is well-formed JSON. It does not confirm that required fields exist, that values have the right types, or that a file matches what an API expects. That is a separate step, usually done with JSON Schema or the receiving application's own checks. A JSON file validator may also not report encoding issues. The JSON standard expects UTF-8 for data exchanged between systems, and says a byte order mark must not be added, though parsers may ignore one. Some tools accept a leading byte order mark silently while a strict consumer rejects it.
Reading the error message
An error checker reports where the parser gave up, which is not always where the mistake is. A missing comma is typically reported at the start of the next key, and an unclosed string or bracket may be reported at the end of the file. Line and column numbers also depend on the tool. Some count from zero and some from one, and some count characters while others count bytes, so a position can be off when the text contains non-ASCII characters. Start at the reported spot and work backward.
Copying, pasting and sharing the result
Most surprises happen on the way into or out of the tool, not in the parser:
- Word processors, chat apps and some note apps convert straight quotes to curly quotes. Curly quotes are not valid JSON delimiters, so text that validated before the paste can fail after it.
- Non-breaking spaces and zero-width characters copied from web pages or documents look like ordinary whitespace but are not JSON whitespace. Outside a string they cause a parse error that is hard to see. Inside a string they become part of the value.
- Tabs versus spaces in indentation does not affect validity, but it can create noisy diffs if the formatter's indent setting differs from the project's.
- Right-to-left text inside string values, such as Arabic or Hebrew, can display in a reordered way in some editors because of bidirectional rendering. The stored character order does not change; only the on-screen arrangement does. Judge such strings by their characters, not by how a viewer lays them out.
Pretty-printed JSON is easier to scan visually than a minified line. How it reads with a screen reader depends on the reader's punctuation and indentation settings. This review did not test any assistive technology, so no specific behavior is claimed. When sharing JSON with people, send it as plain text in a code block or as an attached file rather than in a rich-text body, so quotes and spaces are not converted. When sharing with a machine, minified or pretty-printed output both work, provided the round-trip issues above do not apply.
Privacy: check before pasting
An online JSON tester may process input entirely in the browser or send it to a server. You cannot tell which from the page design or from phrases like "secure" or "private". Read the tool's stated data handling. If none is published, assume the input could leave your machine. Do not paste API keys, tokens, credentials, personal data or production records into a tool you have not checked. Remove or replace sensitive values first, or validate locally instead.
Two widely available command-line options validate and pretty-print without a website. Both parse the input into values and then write it back out, so the round-trip caveats above still apply. Both print an error and return a non-zero exit status on invalid input.
python3 -m json.tool data.json
jq . data.json
Gaps in this review
No specific online JSON validator was tested for this article. No measurements, file-size limits, speed figures, accuracy rates or data-retention practices are reported for any named tool, because none were available. Statements about formatter behavior describe the JSON standard and common parser behavior. They are not results from a particular product. Before relying on any tool, verify how it handles large numbers and duplicate keys, whether it supports non-standard variants such as JSON with comments, and where your input is processed.
Quick checklist
- Use the validator to find syntax errors, then fix them in your original source rather than copying back the tool's output by default.
- If you do copy the output, compare long integers, duplicate keys and escaped characters against the input.
- Remember that comments are not valid JSON and will be lost, not converted.
- Check structure separately with a schema or the consuming application.
- Paste and share through plain-text channels to avoid curly quotes and invisible characters.
- Keep secrets out of any web tool whose data handling you have not confirmed.