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 detailed error reporting, automatic formatting, and minification capabilities 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 instant 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 upload a JSON file

2

The tool automatically validates syntax and highlights any errors

3

Review detailed error messages with line numbers and descriptions

4

Use the format option to beautify and properly indent valid JSON

5

Copy the validated and formatted 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 per RFC 8259 (the current JSON standard) and reports: valid (syntax is correct) or invalid (with the exact line and column where parsing failed). For invalid JSON, the error message describes what was expected vs what was found (e.g., 'expected , or } at line 5 column 8'). 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. The check is purely syntactic — semantic validation (does this JSON match a schema?) is a separate step.

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 validator shows the exact line/column of the first error, so fix from the top down.

What is JSON Schema and why use it?

JSON syntax validation (the default) checks 'is this parseable JSON?'. JSON Schema validation (when you provide a schema) checks 'does this JSON match the expected structure?' — required fields, value types, formats (email, URI, date-time), enum constraints, numeric ranges, array sizes, pattern matching. JSON Schema is the standard for: API contract validation (OpenAPI/Swagger uses JSON Schema), configuration file validation, form data validation in CMSes, and pre-deploy linting of generated JSON. Generate schemas from sample JSON with the [JSON Schema Generator](/tools/json-schema-generator/). The current Draft is 2020-12 (formerly Draft-08); most ecosystems support Draft-07 broadly.

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. The tool pinpoints the exact position; copy a few characters before and after to find subtle issues like invisible Unicode characters (zero-width spaces) that snuck in via copy-paste.

Is online JSON validation safe for sensitive data?

Yes — this tool runs entirely in your browser. Your JSON is parsed locally via the browser's built-in JSON.parse, 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 by default — 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 and let users complain.

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 line/column, fix it, re-validate, repeat until clean. Then format. Pragmatic alternative: copy your broken JSON into a text editor with JSON syntax highlighting (VS Code, Sublime, IntelliJ) — most show errors inline with squiggle underlines, making it easier to fix incrementally. After validation passes, run the result through [JSON Formatter](/tools/json-formatter/) for proper indentation, [JSON Diff](/tools/json-diff/) for comparing versions, or your application's JSON parser.

Can I validate JSON against an OpenAPI/Swagger spec?

Indirectly. OpenAPI specs embed JSON Schema for each request/response body. To validate a JSON payload against an OpenAPI endpoint: extract the relevant schema from the OpenAPI document (look in components.schemas), then validate the payload against that schema using this tool's Schema validation mode. Direct OpenAPI validators (Spectral, openapi-validator) do the schema extraction automatically. For ad-hoc API testing, this two-step approach works: paste the response, paste the schema from the OpenAPI spec, validate. Combine with the [JSON Schema Generator](/tools/json-schema-generator/) to bootstrap schemas from example responses 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