JSON Validator

Validate JSON input for proper structure and syntax. Format, minify, and analyze JSON data. Perfect for debugging API payloads or configuration files.

JSON Input

Validation Results

Enter JSON to see validation results

JSON Format Guide

✓ Valid JSON

  • • Strings must be in double quotes
  • • Object keys must be strings
  • • No trailing commas
  • • Use null instead of undefined
  • • Numbers can be integers or decimals
  • • Booleans are true or false
  • • Arrays can contain mixed types

✗ Common Errors

  • • Single quotes instead of double
  • • Unquoted object keys
  • • Trailing commas
  • • Comments (not allowed in JSON)
  • • Undefined values
  • • Functions or methods
  • • Circular references

Sample JSON Data

About JSON Validator

A comprehensive JSON validation tool that checks JSON data for proper syntax, structure compliance, and formatting standards. This tool provides error reporting, formatting, minification, a structure summary, and warnings for duplicate keys and numbers JavaScript can't hold exactly to help developers work with JSON data efficiently and accurately.

Why use a JSON Validator?

JSON is widely used in APIs, configuration files, and data exchange, but syntax errors can cause application failures and integration issues. This validator provides live feedback on JSON structure problems, saving debugging time and ensuring your JSON data meets standards before deployment or data processing.

Who is it for?

Essential for API developers testing request/response payloads, frontend developers working with JSON data, backend engineers validating configuration files, and data analysts processing JSON datasets. Perfect for anyone who needs to ensure JSON data integrity and proper formatting.

How to use the tool

1

Paste your JSON data into the input area or pick one of the samples

2

The tool validates syntax as you type (or when you click Validate) and shows any error

3

Review the error message; when your browser reports a position, the line and column are shown too

4

Review the structure summary and any warnings, then use Format or Minify on valid JSON

5

Copy the formatted or minified JSON for use in your applications

Frequently Asked Questions

How do I validate JSON?

Paste the JSON into the input area. The tool parses it with the browser's built-in JSON parser (strict RFC 8259 syntax) as you type, and reports valid or invalid. For invalid JSON it shows the parser's message and, when your browser reports a position, the line and column where parsing failed. The validator catches: unmatched braces/brackets, trailing commas (not allowed in strict JSON), single quotes (only double quotes are valid), unquoted keys, JavaScript-style comments (not allowed), and invalid escape sequences. For valid JSON it also shows size, nesting depth and counts of each value type, and warns about duplicate keys and numbers JavaScript can't hold exactly. The check is syntactic only — there is no schema validation.

What's wrong with my JSON?

Most common errors: (1) Trailing comma after the last item in an array or object — `{"a": 1,}` is invalid. (2) Single quotes instead of double — JSON requires double quotes for strings AND keys. (3) Unquoted keys — `{a: 1}` is JavaScript, not JSON; must be `{"a": 1}`. (4) JavaScript comments — `// comment` and `/* */` are not allowed in strict JSON. (5) NaN/Infinity values — JSON has no representation for these (must use a string or null). (6) Multi-line strings without escaping newlines — JSON strings can't span lines without \n escapes. The parser reports the first error it hits, so fix from the top down.

What is JSON Schema, and does this tool validate against one?

JSON syntax validation (what this tool does) checks 'is this parseable JSON?'. JSON Schema validation checks 'does this JSON match the expected structure?' — required fields, value types, formats, enum constraints, numeric ranges, array sizes, pattern matching. This tool does not validate against a schema; use a schema validator in your own code or build pipeline for that. JSON Schema is the standard for: API contract validation (OpenAPI uses it), configuration file validation, and pre-deploy linting of generated JSON. You can generate a schema from sample JSON with the [JSON Schema Generator](/tools/json-schema-generator/).

Why does my JSON parser say it's invalid?

Beyond the common syntax errors, two subtle causes: (1) Encoding — JSON must be UTF-8 (or UTF-16 / UTF-32, but UTF-8 is the only universally-supported encoding). Files saved as Windows-1252 or with a BOM (byte-order mark) can fail. Strip BOM and re-save as UTF-8 without BOM. (2) Whitespace in numbers — JSON allows whitespace BETWEEN tokens but not inside them. `1 2` isn't a valid number; `"1"` is a string; `1.5e10` is a valid number; `1.5 e10` is two tokens. Use the reported position, if any, and look at a few characters before and after it to find subtle issues like invisible Unicode characters (zero-width spaces) that snuck in via copy-paste. Another cause of surprise: a parser may silently keep only the last of two duplicate keys — this tool warns about those.

Is online JSON validation safe for sensitive data?

Yes — this tool runs entirely in your browser. Your JSON is parsed locally, with no network call, no logging, no telemetry. Verify in DevTools' Network tab: validation produces zero HTTP requests. The JSON never leaves your device. This makes the tool safe for validating: API responses containing PII, configuration files with secrets (though you should redact secrets before pasting anywhere — including local browser tools), and internal data structures. For production validation in pipelines, use a server-side JSON parser in your build/test process — this tool is for ad-hoc inspection.

What's the difference between strict and lenient JSON?

Strict JSON (RFC 8259) is the spec: double-quoted strings and keys, no trailing commas, no comments, no unquoted keys, no NaN/Infinity. Lenient parsers (called 'JSON5' or 'extended JSON' or 'json-with-comments') accept all of these and more. This tool validates strict JSON only — if you're shipping JSON to other systems (APIs, browsers, libraries), strict is what they expect. JSON5 is useful for configuration files where humans edit by hand (the trailing comma and comment ergonomics matter). Modern tooling: VS Code's settings.json accepts JSONC (JSON with comments); package.json must be strict; .babelrc accepts JSON5. When in doubt, use strict.

How do I format/pretty-print invalid JSON?

You can't — formatters (including the [JSON Formatter](/tools/json-formatter/) tool) need a parseable input to walk the structure. Fix the syntax first using this validator: paste the JSON, find the error at the reported position, fix it, re-validate, repeat until clean. Then format. After validation passes, use Format here, the [JSON Formatter](/tools/json-formatter/) for a choice of indent size, or [JSON Diff](/tools/json-diff/) for comparing versions.

Can I validate JSON against an OpenAPI/Swagger spec?

Not directly — this tool has no schema validation mode. OpenAPI specs embed JSON Schema for each request/response body, so to check a payload against an endpoint you need a schema validator that supports JSON Schema (in your code, tests or build pipeline) and the relevant schema extracted from the OpenAPI document (look in components.schemas). What this tool can do is confirm that the payload itself is well-formed JSON before you run it through such a validator. You can also use the [JSON Schema Generator](/tools/json-schema-generator/) to bootstrap a schema from an example response when you're documenting a new API.

Share This Tool

Found this tool helpful? Share it with others who might benefit from it!

💡 Help others discover useful tools! Sharing helps us keep these tools free and accessible to everyone.

Support This Project

Buy Me a Coffee