JSON Validator
Quick Access to JSON Tools
Go straight to the JSON utility you need.
How to Use the JSON Validator
Paste your JSON data
Paste your JSON data.
Click Validate
Click Validate.
See validation results and error details
See validation results and error details.
JSON Validator — Check JSON Syntax Before Using It in Your Code
Invalid JSON is one of the most common and frustrating sources of bugs in web development. A missing comma, an extra trailing comma, single quotes instead of double quotes — any of these will cause JSON.parse() to throw an error and break your application. The worst part is that JSON syntax errors are often invisible when you're looking at a large data structure. A validator catches these issues instantly, showing you exactly where the problem is and what went wrong.
Our free JSON validator runs entirely in your browser. Paste your JSON, click validate, and get immediate feedback. Valid JSON shows a success message with confirmation. Invalid JSON shows a detailed error including the approximate line and character position where the problem was detected.
Why JSON Validation Matters More Than You Think
JSON errors don't always surface immediately. If you're building an API that accepts JSON request bodies, an invalid payload from a client might trigger a 500 error that's hard to diagnose. If you're loading a configuration file at startup, a single syntax error prevents the entire application from launching. If you're consuming a third-party API and storing the response, corrupted JSON in your database can cause downstream failures that are painful to trace back.
Validation catches these problems at the point of origin — before the JSON ever reaches your parser, your database, or your configuration loader. It's the equivalent of a compiler catching syntax errors before your code runs. The earlier you find the problem, the cheaper it is to fix.
In CI/CD pipelines, JSON validation is a standard step. Schema validation — checking that a JSON document not only has valid syntax but also conforms to an expected structure — prevents broken deployments caused by malformed config files or invalid API payloads.
The Most Common JSON Syntax Errors (and How to Fix Them)
Trailing commas: This is the single most frequent JSON syntax mistake. In JavaScript, { "key": "value", } is perfectly valid. In JSON, that trailing comma after the last property causes a parse error. Remove the comma after the final item in any object or array.
Single-quoted strings: JSON requires double quotes for all keys and all string values. { 'name': 'Alice' } is valid JavaScript but invalid JSON. Change every single quote to a double quote.
Unquoted keys: Object keys must be enclosed in double quotes. { name: "Alice" } works in JavaScript as shorthand but is invalid JSON. The correct form is { "name": "Alice" }.
Comments: JSON does not support comments of any kind — neither // line comments nor /* */ block comments. If you need comments in a JSON-like format, you're looking at JSONC (used by VS Code's settings files), which requires a different parser.
Invalid number formats: Leading zeros (007), hexadecimal numbers (0xFF), and special values like NaN, Infinity, or -Infinity are all invalid in JSON. Numbers must be decimal, finite, and without leading zeros (unless the value is exactly 0).
Unescaped characters in strings: Double quotes, backslashes, and control characters inside string values must be properly escaped. For example, "She said "hello"" should be "She said \"hello\"". Unescaped characters break the string boundary and confuse the parser.
Understanding JSON's Data Types
JSON supports exactly six data types, and knowing them helps you spot errors that a linter might miss:
- Strings: Text enclosed in double quotes. Supports Unicode escapes (
\uXXXX) and standard escape sequences (\n,\t,\\,\"). - Numbers: Decimal integers and floating-point numbers. No leading zeros, no trailing decimal point without a digit, no special values like NaN or Infinity.
- Booleans: Exactly
trueorfalse(lowercase, no quotes). - Null: Exactly
null(lowercase, no quotes). Represents absence of value. - Objects: Key-value pairs enclosed in curly braces. Keys must be strings. Values can be any JSON type.
- Arrays: Ordered lists enclosed in square brackets. Elements can be any JSON type.
Anything outside these six types — undefined, NaN, functions, dates, regular expressions — is not valid JSON. If you need to represent a date, store it as an ISO 8601 string ("2024-01-15T10:30:00Z"). If you need to represent a function, you're using the wrong format for that data.
Validation vs. Formatting vs. Minification
These three operations serve different purposes:
- Validation checks correctness. It tells you whether your JSON follows the syntax rules. If it doesn't, it tells you what's wrong and where.
- Formatting improves readability. It adds indentation and line breaks to make the structure visible. It doesn't check for errors — formatting invalid JSON will fail.
- Minification reduces file size. It removes whitespace to make the payload smaller. It also doesn't check for errors — minifying invalid JSON will fail.
The right workflow: validate first to catch errors, then format or minify depending on whether the output is for human eyes or machine consumption. Skipping validation and going straight to formatting or minifying means you'll hit the same parse error later in your pipeline, when it's harder and more expensive to fix.
Practical Validation Scenarios
Before pasting into a database: If you're importing JSON data into MongoDB, Elasticsearch, or a PostgreSQL JSONB column, validate first. A single syntax error can abort an entire import operation.
After copying from a browser console: When you copy JSON from a browser's network tab or console output, you might inadvertently include JavaScript-specific syntax like undefined or unquoted keys. Validate before using that data elsewhere.
When receiving JSON from a third party: API responses are usually well-formed, but webhooks, form submissions, and data exports sometimes contain malformed JSON. Validate incoming data before processing it.
Before committing config files: A broken package.json, tsconfig.json, or settings.json can break your build or editor. Validate these files before committing them to version control.
Frequently Asked Questions
// and /* */ comments and is used by VS Code for settings and TypeScript config files. Standard JSON does not allow comments. This validator checks against standard JSON. If your file contains comments, remove them before validating.jq empty or language-specific validators.