When you need a JSON validator
Frontend throws Unexpected token, backends reject payloads, config centers fail to load—first check: is this text valid JSON?
ComTools JSON Validator (Tools/Json/Validator) runs JSON.parse in the browser: success shows a valid message (and can pretty-print with your indent); failure surfaces the engine error so you can fix the syntax.
Steps
- Open JSON Validator.
- Paste text (or use Sample).
- Optionally pick indent (2 / 4 / Tab) for the pretty view on success.
- Click Run.
- Read the status: valid, or the parse error details.
Nothing is uploaded—validation is local.
Valid vs invalid examples
Valid
{
"id": 1,
"name": "Alice",
"active": true,
"tags": ["a", "b"],
"meta": null
}
Common invalid patterns
| Issue | Bad example | Fix |
|---|---|---|
| Trailing comma | {"a":1,} |
Remove the last comma |
| Single quotes | {'a':1} |
Use "a" |
| Unquoted keys | {a:1} |
"a": 1 |
| Comments | {"a":1 // x} |
Not allowed in JSON |
| Trailing array comma | [1,2,] |
Remove trailing comma |
| Unescaped quotes | {"msg":"say "hi""} |
Use \" |
NaN / JS-only values |
{ "n": NaN } |
Use null or a string |
Browser messages often look like: Unexpected token ... in JSON at position N—jump near that offset.
After it validates
| Next step | Tool |
|---|---|
| Readable view | JSON Formatter |
| One line | JSON Minify |
| Diff two responses | JSON Compare |
| C# classes | JSON to C# |
| Array → INSERT | JSON to SQL |
| Extract fields | JSONPath |
Validator vs formatter
- Validator: pass/fail first; may pretty-print on success.
- Formatter: indent, highlight, fold; also errors on invalid JSON.
Use the validator for a quick green/red check; use the formatter to browse large documents.
Notes
- JSON ≠ JavaScript objects: no
undefined, functions,NaN, or trailing commas. - Dates are usually ISO strings, not a native Date type.
- Huge payloads can freeze the tab—validate a subtree first if needed.
FAQ
How do I use position N?
Count characters from the start (including newlines), or search near , ' { in the snippet.
JSON5 / YAML?
Strict JSON only. Convert loose formats to standard JSON first.
Empty input?
Treated as invalid.
Array root OK?
Yes—[1,2,3] and {...} are both valid roots.