JSON Validator
JSON ToolsValidate JSON syntax and schema — pinpoint errors by line and column. Free, private — all processing in your browser.
When JSON fails to parse, the error message is often unhelpful: "unexpected token at position 347" tells you nothing about what to fix. The JSON Validator finds and explains syntax errors with precise line and column numbers, shows the problematic character highlighted in context, and suggests specific fixes for common mistakes — missing commas, trailing commas, unescaped quotes, invalid Unicode sequences, mismatched brackets. Goes beyond a simple "valid/invalid" check: explains why and where, and walks you through fixing each error.
Also supports JSON Schema validation — check that your JSON matches a specified schema (types, required fields, enum values, patterns, nested structure). Essential for validating API request/response bodies, configuration files, and data pipelines. The validator uses the Ajv JSON Schema library with support for Draft 7, Draft 2019-09, and Draft 2020-12. All validation runs in your browser — your JSON and schemas never upload anywhere. Perfect for validating sensitive API payloads, internal configs, or schema files under active development.
JSON Validator — key features
Precise error locations
Every syntax error is located by line AND column, with the exact character highlighted and context shown.
Human-readable error messages
Instead of "unexpected token", you get "missing comma between properties on line 3". Each error comes with a suggested fix.
JSON Schema validation
Validate your JSON against a schema. Supports Draft 7, 2019-09, and 2020-12. Powered by Ajv.
Common mistake detection
Tool recognizes common anti-patterns (single quotes, unquoted keys, trailing commas) and suggests the correct form.
BOM and whitespace handling
Detects Byte Order Marks, invisible Unicode characters, and whitespace issues that confuse other validators.
Tree view of valid JSON
Once valid, view your JSON as a collapsible tree. Click any node to copy its JSONPath.
Schema generator
Paste valid JSON and get a draft JSON Schema — a starting point for building validation.
Paste, upload, or URL input
Type, paste, drop a .json file, or fetch from a URL (CORS-permitting).
How to use the JSON Validator
- 1
Paste your JSON
Drop in JSON from an API response, config file, or log. Size up to ~50 MB.
- 2
Read the validation result
If valid: green checkmark and summary (size, depth, count of objects/arrays). If invalid: specific error with line and column.
- 3
Fix errors one at a time
The first error is highlighted. Fix it, re-validate. Tool finds next error if any.
- 4
(Optional) Validate against schema
Paste a JSON Schema in the second panel. Tool checks every required field, type, constraint against your data.
- 5
(Optional) Generate schema
Click "Generate schema" to create a Draft 7 schema from your current JSON — useful starting point for API docs.
Common use cases for the JSON Validator
API development
- →Validate API request bodies: Before shipping, validate incoming requests against your schema. Reject invalid payloads early with a 400 error.
- →Validate API response bodies: In tests, validate that responses match the documented schema. Catches accidental breaking changes.
- →OpenAPI schema debugging: OpenAPI specs include JSON Schemas. Test schemas against example payloads to verify they're correct.
- →Mock data validation: Generated mock data may not match schema. Validate before using in tests.
Configuration files
- →Validate tsconfig.json, eslintrc, prettierrc: These config files have official JSON Schemas. Validate to catch typos and wrong types before they cause build errors.
- →Validate package.json: npm publishes a package.json schema. Validate to avoid publish errors.
- →Kubernetes manifests (when converted): If you convert K8s YAML to JSON, validate against the Kubernetes OpenAPI schema.
- →CI pipeline configs: GitHub Actions, GitLab CI — validate before pushing to catch config errors locally.
Data pipelines
- →Validate incoming webhook payloads: Payment processors, SaaS webhooks send JSON — validate against expected schema to reject malformed or tampered payloads.
- →ETL data quality: Extract-transform-load pipelines — validate JSON at ingestion to catch upstream data issues.
- →Schema evolution testing: When updating schemas, validate old and new data against both versions to detect breaking changes.
Learning and debugging
- →Debug "invalid JSON" errors: When an API call fails with a parse error, paste the body here to find the exact problem.
- →Learn JSON Schema: Experiment with schemas, see what fails, learn which constraints do what.
- →Verify manual edits: After hand-editing a large config file, validate to catch accidental syntax errors.
JSON Validator — examples
Missing comma error
Most common JSON mistake.
{
"name": "Alice"
"age": 30
}✗ Invalid JSON Error at line 3, column 3: Expected `,` or `}` after property value Fix: Add `,` after "Alice"
Single quotes instead of double
JavaScript habit that breaks JSON.
{ 'name': 'Alice' }✗ Invalid JSON Error at line 1, column 3: Keys and string values must use double quotes Fix: Replace single quotes with double quotes
Valid JSON — tree view
Successful validation.
{"user":{"name":"Alice","roles":["admin","editor"]}}✓ Valid JSON (RFC 8259)
Size: 62 bytes, depth: 3
▾ user (object)
• name: "Alice"
▾ roles (array, 2 items)
[0]: "admin"
[1]: "editor"Schema validation — missing field
Detect missing required field.
Schema: { required: ["name", "email"] }
Data: { "name": "Alice" }✗ Schema validation failed Error at root: missing required property "email"
Schema validation — wrong type
Detect type mismatch.
Schema: age must be integer, min 0
Data: { "age": "thirty" }✗ Schema validation failed Error at /age: expected integer, got string Error at /age: invalid value
BOM detection
Invisible character at file start.
\uFEFF{ "valid": true }⚠ Byte Order Mark detected at start of file JSON.parse in strict mode rejects this. Fix: Strip BOM before parsing. Most editors have "Save without BOM" option.
Technical details
JSON validation has two layers: syntax validation (is it valid JSON per RFC 8259?) and schema validation (does the structure match expected fields and types?).
Syntax errors the validator catches:
Most common JSON errors with explanations:
| Error | Example | Fix |
|---|---|---|
| Missing comma | {"a":1 "b":2} | Add , between properties |
| Trailing comma | {"a":1,} | Remove final , |
| Unquoted key | {a: 1} | Quote key: {"a": 1} |
| Single quotes | {'a': 1} | Use double quotes: {"a": 1} |
| Unescaped quote in string | {"a": "hello "world""} | Escape: "hello \\"world\\"" |
| Unescaped newline | "line 1\\nline 2" literal newline | Use \\n escape |
| Control characters | {"a": "text<CR>"} | Escape as \\r |
| Leading zero | {"a": 007} | Remove leading zeros: {"a": 7} |
| BOM at start | \\uFEFF{"a":1} | Strip byte-order mark |
| Duplicate keys | {"a":1, "a":2} | RFC 8259 allows but discourages; parser-dependent behavior |
| NaN, Infinity | {"a": NaN} | Use string "NaN" or null |
| Comments | // comment | JSON doesn't allow — use JSON5 or strip before validating |
JSON Schema validation (Draft 7 / 2020-12):
JSON Schema describes the expected structure:
``json``
{
"type": "object",
"required": ["name", "email"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"email": { "type": "string", "format": "email" },
"age": { "type": "integer", "minimum": 0, "maximum": 150 }
}
}
Checks against a JSON payload:
``json``
{ "name": "", "email": "not-an-email" }
Reports:
- name fails minLength constraint (empty string).
- email is missing @ (format validation).
Schema drafts:
- Draft 4 (2013) — legacy, widely supported.
- Draft 7 (2019) — widely adopted, supported by most validators.
- Draft 2019-09 — added unevaluatedProperties, $anchor.
- Draft 2020-12 — current standard, matches OpenAPI 3.1.
JSON Schema vs TypeScript types:
TypeScript types give compile-time checks; JSON Schema gives runtime validation. Use JSON Schema to validate data coming from outside your code (API inputs, config files, user-submitted data). Generate TypeScript types from JSON Schema with json-schema-to-typescript for both.
Validation performance:
The Ajv library compiles schemas into optimized JavaScript functions — validation is typically faster than JSON.parse itself. For high-throughput APIs, use Ajv in production.
Common problems and solutions
⚠Validator passes but consumer rejects
Different parsers have different tolerance for edge cases (duplicate keys, large numbers, BOM). This validator follows strict RFC 8259. If your production consumer uses a stricter subset (no duplicate keys), validate accordingly.
⚠Schema written against wrong draft
JSON Schema has multiple drafts (4, 7, 2019-09, 2020-12). Features like `unevaluatedProperties` only exist in newer drafts. Specify `"$schema"` in your schema to declare the draft.
⚠Number precision loss
JSON numbers become IEEE 754 doubles when parsed. Large integers (over 2^53) lose precision: `9007199254740993` becomes `9007199254740992`. If you need large integers, use strings: `"9007199254740993"` or BigInt libraries.
⚠Escaped character confusion
`"path": "C:\\Users\\Alice"` — backslash must be escaped. `"quote": "She said \"hi\""` — quotes inside strings must be escaped. The validator shows exactly where.
⚠Comments rejected
JSON doesn't allow comments. If your source has `//` or `/* */` comments, strip them before validating, or use JSON5/JSONC parsers instead.
⚠UTF-8 encoding issues
JSON must be UTF-8. Files with Windows-1252 or other encodings fail with "invalid UTF-8 sequence". Re-save as UTF-8 in your editor.
⚠Schema too strict / too lenient
`additionalProperties: false` rejects any extra fields — strict for APIs but brittle for evolving data. `additionalProperties: true` (default) accepts anything. Choose based on how much change you expect.
⚠Large JSON blocks browser
Multi-megabyte JSON may slow validation. For huge files, use CLI tools (`jq`, `jsonlint`) that stream-parse. This tool loads the whole JSON in memory.
JSON Validator — comparisons and alternatives
JSON Validator vs JSON Formatter: Validator tells you if JSON is valid and why it's not. Formatter pretty-prints valid JSON (and also reports syntax errors). For error-finding with schema validation, use the validator. For formatting clean JSON, use our JSON Formatter.
JSON Schema vs TypeScript types: TypeScript gives compile-time checks within your code. JSON Schema gives runtime validation for data crossing boundaries (API inputs, config files). Use both — generate TypeScript types from JSON Schema for end-to-end type safety.
JSON Schema vs Joi / Yup / Zod: JavaScript-specific validation libraries (Joi, Yup, Zod) are more convenient for runtime validation in JavaScript apps but aren't portable. JSON Schema is language-agnostic — use it for API contracts shared across languages.
JSONLint vs this tool: JSONLint is the original web-based validator. This tool adds schema validation, better error messages, and runs entirely client-side (JSONLint uploads to their server).
Validator vs Linter: A validator checks if JSON is *valid*. A linter enforces *style* (indentation, key ordering). Both are useful. For style, see Prettier or jsonlint with style config.
Frequently asked questions about the JSON Validator
▶What is a JSON validator?
A tool that checks if JSON is syntactically correct per RFC 8259 (the JSON specification). Good validators also locate errors precisely (line and column) and explain how to fix them. Schema validators go further — they check if the JSON matches a specified structure (required fields, types, constraints).
▶Why is my JSON invalid?
Most common causes (in order of frequency): Missing comma between properties, trailing comma before ] or }, single quotes instead of double, unquoted keys, unescaped special characters in strings (quotes, newlines), BOM at file start, invalid Unicode escapes. This validator finds and explains each.
▶What's the difference between JSON syntax and JSON Schema validation?
Syntax validation checks only if the JSON follows the language rules — brackets match, strings are quoted, numbers are numbers. Schema validation checks if the content matches expected structure — required fields present, types match, values in allowed ranges. Both are useful; schema validation is stricter.
▶Which JSON Schema draft should I use?
Draft 2020-12 is the current standard and matches OpenAPI 3.1. Draft 7 is still widely supported and may be easier for older tooling. Newer drafts support more features (unevaluatedProperties, $anchor); older drafts are simpler. Pick based on your tooling support.
▶Is my JSON safe to paste here?
Yes. Validation runs entirely in your browser. Your JSON (including sensitive API payloads, credentials in auth tokens, internal configs) never uploads anywhere. Check DevTools Network tab to verify.
▶Can this validate against my custom schema?
Yes. Paste your JSON Schema in the schema input. Tool uses Ajv (industry-standard validator) to check every field, type, pattern, and constraint. Works for all common JSON Schema drafts.
▶What if my JSON has comments?
Strict JSON (RFC 8259) doesn't allow comments — the validator rejects them. Workarounds: (1) Strip comments before validating. (2) Use JSON5 or JSONC (JSON with comments) validators instead — these are variants that allow // and /* */.
▶How does this handle large numbers?
JSON numbers parse to IEEE 754 floats. Integers over 2^53 lose precision — a well-known JSON limitation. For IDs or financial values needing full precision, use strings: "userId": "9007199254740993". The validator warns on potentially-unsafe integers.
▶Can it generate a schema from my JSON?
Yes. Click "Generate schema" with valid JSON loaded. Output is a Draft 7 schema inferring types, required fields, and basic constraints. Use as a starting point — manually add patterns, formats, and descriptions for production use.
▶Does it support streaming validation?
No — validation requires the entire JSON in memory. For multi-gigabyte files, use streaming parsers (oboe.js in JavaScript, ijson in Python, jq --stream in CLI). This tool handles up to ~50 MB comfortably.
Additional resources
- JSON Schema — Current Specification — Official JSON Schema documentation and drafts.
- Ajv — JSON Schema Validator — Industry-standard JSON Schema validation library (used by this tool).
- JSONLint — Classic web-based JSON validator (server-side).
- OpenAPI 3.1 Specification — Uses JSON Schema 2020-12 for request/response validation.
- RFC 8259 — JSON Specification — Official IETF JSON standard.
Related tools
All JSON ToolsCSV to JSON Converter
Convert CSV files to JSON arrays or objects with custom delimiters
JSON Diff
Compare two JSON objects — find added, removed, and changed properties
JSON Escape/Unescape
Escape JSON for embedding in code or unescape JSON strings back to readable format
JSON Formatter
Format, validate, and beautify JSON instantly in your browser
JSON Minifier
Compact JSON by removing whitespace — reduce file size by up to 80%
JSON to CSV
Flatten nested JSON into CSV rows — ready for Excel, Google Sheets, analysis
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →