JSON Validator — Check if JSON is Valid Online
Validate JSON online with instant error location and structure statistics (depth, keys, node types). 100% local — your JSON never leaves the browser.
Last updated:
Valid JSON
Compliant with RFC 8259 · root type: object
Structure statistics
- Depth
- 3
- Keys
- 4
- Nodes
- 8
Nodes by type
Payload size: 99 B (UTF-8)
Structure preview
Click any node to fold or expand · use the filter to jump by key
Paste JSON above to instantly check if it is valid per RFC 8259. The validator pinpoints the exact error location and reports structure statistics (depth, key count, node types) — all locally in your browser.
What is JSON Validator?
A JSON validator checks whether a text document conforms to the JSON grammar defined by RFC 8259 (ECMA-404). Unlike a formatter, which reshapes valid JSON into a readable layout, a validator answers a single, non-negotiable question: is this JSON syntactically legal? For any error it reports the exact line, column, and cause — critical when debugging an API payload, a CI config, or a webhook body. This page also surfaces structure statistics that make it easier to reason about unfamiliar payloads at a glance.
How to validate JSON online
- 1Paste your JSON into the input editor on the left.
- 2The status card on the right turns green (Valid) or red (Invalid) immediately.
- 3If invalid, the exact line and column of the first syntax error are shown, along with the parser message.
- 4If valid, the tool reports the root type, max depth, key count, node count, and a breakdown by JSON type.
- 5Fix the error at the reported position and re-validate — no upload, no page reload required.
Use Cases
Debug an API request body
Before firing a curl or Postman request, paste the body in to catch missing commas, mismatched brackets, or accidental single quotes.
Verify config files
package.json, tsconfig.json, and Kubernetes manifests are strict JSON — even a stray comma can break the whole build. Validate before committing.
Inspect unfamiliar payloads
When a third-party webhook or log line hands you JSON, the structure stats (depth, key count) give you a sense of shape without reading every line.
Teach or review JSON
The color-coded 'nodes by type' breakdown makes it easy to explain what kinds of values are in a document — useful in code reviews or onboarding.
Code Examples
Validate JSON in Node.js
function isValidJson(input) {
try {
JSON.parse(input);
return true;
} catch (err) {
console.error(err.message); // includes position on modern V8
return false;
}
}Validate JSON in Python
import json
def is_valid_json(s: str) -> bool:
try:
json.loads(s)
return True
except json.JSONDecodeError as e:
print(f"error at line {e.lineno}, col {e.colno}: {e.msg}")
return FalseValidate JSON from the terminal
# jq exits non-zero on invalid JSON
echo "$payload" | jq empty && echo "valid" || echo "invalid"Validate JSON in Go
import "encoding/json"
func isValidJSON(data []byte) bool {
return json.Valid(data)
}Key Concepts
- RFC 8259
- The current authoritative JSON specification. Defines the six structural characters { } [ ] , : and the three literals true / false / null.
- Strict vs lenient parsing
- Strict parsers (JSON.parse, encoding/json, Python's json module) follow RFC 8259 to the letter. Lenient ones (JSON5, JSONC) allow comments, trailing commas, and unquoted keys.
- Well-formed vs valid
- Well-formed means syntactically parseable. Valid, in a JSON Schema context, means the parsed document also matches a declared shape. This tool checks the first, not the second.
- Root type
- JSON documents can have any of six root types — object, array, string, number, boolean, null. Older RFC 4627 only allowed object or array; RFC 8259 lifted that restriction.
Tips & Best Practices
- ▸Trailing commas are the #1 cause of 'unexpected token' errors — remove the comma after the last element of an array or object.
- ▸Keys are always strings in double quotes. `{ name: "x" }` is JavaScript, not JSON.
- ▸Standard JSON has no comments. If you need them, use JSON5 or JSONC and strip them before feeding into a strict parser.
- ▸JSON numbers may not be NaN or Infinity. Serialize special floats as null or a sentinel string.
- ▸For large payloads, prefer streaming validators (`stream-json` in Node, `ijson` in Python) — they detect errors without loading the whole document into memory.
Frequently Asked Questions
How is this different from a JSON formatter?
A formatter reshapes valid JSON into a pretty layout. A validator focuses on the yes/no question — is this JSON syntactically legal per RFC 8259? — and pinpoints the exact error location when it isn't. This page also reports structure statistics (depth, key count, node types) that formatters typically don't surface.
Which JSON specification does the validator follow?
RFC 8259 (a.k.a. ECMA-404). Trailing commas, single quotes, unquoted keys, comments, and NaN/Infinity are rejected — they are all extensions that live outside strict JSON. Use a JSON5 or JSONC parser if you need those features.
Is my JSON uploaded to any server?
No. Validation and structure analysis run entirely in your browser via the built-in JSON.parse. Your input is never transmitted, logged, or stored.
Why does the validator show 'position X' but not a line number?
Browsers historically expose only a byte position in JSON.parse errors. The tool converts that position into a line/column pair by scanning the input up to the reported offset. On very short inputs or non-standard errors, the line/column may be missing — the raw error message is always shown as fallback.
Related Tools
JSON Formatter
Format, beautify, and validate JSON online. Free, fast, and 100% local — your data never leaves your browser.
JSON Schema Validator
Validate a JSON payload against a JSON Schema online. Supports Draft 2020-12, format validation (date-time, uuid, email, uri), and shows errors by JSON pointer path. 100% local — nothing is uploaded.
JSON Schema Generator
Generate a JSON Schema from a sample JSON — output as standard Draft 2020-12, OpenAI function calling schema, or Anthropic tool_use schema. Powers LLM structured output pipelines.
JSONPath Tester
Test JSONPath expressions against sample JSON online. Get instant, highlighted results for queries like $.store.book[*].author.
JSON Diff
Compare two JSON documents structurally and see added, removed, and changed values by path. Handles nested objects, arrays, and type changes.
JSON Escape
Escape strings for use inside JSON, or unescape JSON string literals back to plain text. Handles quotes, newlines, tabs, and Unicode.