JSON Tools

JSON Validator

Validate JSON online instantly. Detect syntax errors, find line numbers, and debug malformed JSON with real-time feedback.

Your data never leaves your browser — nothing is sent to any server.

Paste JSON above, upload a file, or drag and drop

How to use
  1. 1

    Paste or upload your JSON

    Type or paste JSON directly into the input area. You can also click "Upload JSON" to select a .json file from your device, or drag and drop a file onto the input area.

  2. 2

    Review real-time validation

    As you type, the validator runs continuously. A green "Valid JSON" badge appears when the input is well-formed. A red "Invalid JSON" badge appears with the error message, line number, and column when there is a syntax problem.

  3. 3

    Inspect errors and fix them

    When validation fails, read the error message to understand what went wrong (e.g., unexpected token, missing comma, unterminated string). The line and column numbers help you jump directly to the issue in your editor.

  4. 4

    Copy the formatted output

    Once your JSON is valid, the tool displays a pretty-printed version with 2-space indentation. Click "Copy Formatted" to copy the cleaned-up JSON to your clipboard for use in config files, API requests, or documentation.

Common errors

Trailing comma after the last property or array element

JSON does not allow trailing commas. Remove the comma after the last item in every object and array. For example, change {"a": 1,} to {"a": 1}.

Single quotes instead of double quotes

JSON requires double quotes for all strings and property names. Replace all single quotes (') with double quotes ("). {'key': 'value'} must become {"key": "value"}.

Unquoted property names

Every key in a JSON object must be a double-quoted string. {name: "Alice"} is invalid; it must be {"name": "Alice"}. This is a common mistake when converting JavaScript objects to JSON.

Unexpected token at the beginning of the input

This usually means the input is not JSON at all (e.g., XML, YAML, or plain text), or the file starts with a UTF-8 BOM. Ensure the input starts with {, [, or a valid JSON primitive. Remove any invisible characters before the first token.

FAQ (7)
What counts as valid JSON?

Valid JSON must conform to the ECMA-404 standard. The root value must be an object, array, string, number, boolean, or null. All property names must be double-quoted strings. Trailing commas after the last element in an array or object are not allowed. Single quotes, unquoted keys, comments, and undefined are all invalid in JSON.

Why does my JSON fail validation even though it looks correct?

Common invisible issues include a UTF-8 BOM (byte order mark) at the start of the file, non-breaking spaces (U+00A0) instead of regular spaces, curly quotes (“”) instead of straight double quotes ("), or control characters embedded in strings. Copy your JSON into a hex editor or use this validator to pinpoint the exact error position.

Is there a size limit for JSON validation?

This tool runs entirely in your browser, so the limit depends on your device’s memory. It comfortably handles files up to 5 MB. For file upload, the maximum accepted size is 5 MB. For extremely large JSON (hundreds of megabytes), consider using a streaming parser like jq or a language-native library.

Does this validator support JSON5, JSONC, or JSON with comments?

No. This tool validates strict JSON per RFC 8259 / ECMA-404. JSON5, JSONC (JSON with comments), and other supersets allow features like trailing commas, single-quoted strings, and comments that are not part of the JSON specification. If you need to work with these formats, strip the non-standard syntax first or use a dedicated JSON5 parser.

How does line-number error detection work?

When JSON.parse() throws a SyntaxError, modern JavaScript engines include the character position of the failure in the error message. This validator extracts that position, then counts newline characters from the beginning of the input up to that offset to calculate the line and column number. This gives you a precise location to investigate in your original source.

Is my JSON data sent to a server?

No. All validation and formatting happen locally in your browser using the native JSON.parse() and JSON.stringify() functions. Your data never leaves your device. There are no network requests, no analytics on input content, and no server-side processing.

What is the difference between JSON validation and JSON linting?

JSON validation checks whether a string is syntactically correct JSON — it either parses or it doesn’t. JSON linting (as popularized by JSONLint) typically adds style checks like consistent indentation, but at its core it also performs parsing-based validation. This tool validates and also formats the output, giving you both capabilities.

Learn more

JSON Validator — Validate, Debug, and Format JSON Online

JSON (JavaScript Object Notation) is the dominant data interchange format on the modern web. APIs, configuration files, NoSQL databases, message queues, and infrastructure-as-code tools all rely on valid JSON to function correctly. A single misplaced comma, an unquoted key, or an invisible Unicode character can cause a parser to reject the entire payload — often with a cryptic error message that doesn't point to the root cause. This free JSON validator helps you catch those errors instantly, right in your browser.

How the Validator Works

The tool uses the browser's native JSON.parse() function, which implements the ECMA-404 / RFC 8259 JSON specification. When parsing fails, the engine throws a SyntaxError that includes the character offset of the failure. The validator extracts this offset and maps it to a human-readable line and column number by scanning the input for newline characters. This means you get the same validation behavior that your JavaScript runtime, Node.js server, or Python json module would give you — with the added benefit of a visual, interactive interface.

When You Need a JSON Validator

Debugging a failing API response is the most common use case, but there are many others. DevOps engineers editing Terraform JSON configurations, Kubernetes manifests in JSON format, or AWS CloudFormation templates need to validate syntax before applying changes to production infrastructure. Backend developers building REST or GraphQL APIs use validators to ensure response payloads are well-formed before shipping. Frontend engineers working with i18n translation files, theme configurations, or mock data fixtures use validators to prevent runtime crashes. Data engineers transforming NDJSON (newline-delimited JSON) streams need per-line validation to catch corruption early.

Common JSON Pitfalls

Trailing commas are the most frequent cause of invalid JSON in practice. JavaScript and TypeScript allow them, so developers often forget that JSON does not. Single-quoted strings are another top offender — JSON mandates double quotes everywhere. Comments (// or /* */) are not part of the JSON specification, even though formats like JSONC accept them. Numeric edge cases trip people up too: leading zeros (007), hex literals (0xFF), and NaN / Infinity are all invalid in JSON. Finally, unescaped control characters (tabs, newlines) inside string values will cause a parse failure unless properly escaped as \t and \n.

Beyond Validation: Formatting and Readability

When your JSON is valid, this tool automatically pretty-prints it with consistent 2-space indentation. Minified JSON — the kind you get from API responses or log files — becomes readable in one step. You can copy the formatted output directly to your clipboard for use in documentation, pull requests, or config files. If you need more formatting options like custom indentation or sorting keys, try our companion JSON Formatter tool.

Privacy and Security

This tool runs entirely client-side. Your JSON never leaves your browser — there are no server roundtrips, no data logging, and no third-party analytics on your input. This makes it safe to validate sensitive configuration files, API keys (wrapped in JSON), and internal data structures without risk of exposure. The page works offline once loaded, and the source code is open for inspection.

Technical Specifications

The validator supports files up to 5 MB via drag-and-drop or file upload. Direct paste has no hard limit beyond your browser's memory. Validation runs synchronously on the main thread, so extremely large documents (10 MB+) may cause brief UI lag. The formatting output uses JSON.stringify with 2-space indentation — the same default used by npm init, Prettier, and most modern toolchains. The tool is keyboard-accessible and works in all major browsers including Chrome, Firefox, Safari, and Edge.