ByteCompress

JSON Validator

Check whether your JSON is syntactically valid against RFC 8259. Get precise error messages with line and column numbers to fix issues quickly.

0 chars
FreeClient-sideNo signup

A trailing comma after the last element in an array is the single most common JSON error β€” and it is invisible to the eye in minified output. JSON parsing errors account for roughly 15% of API debugging time, according to StackOverflow's 2023 developer survey analysis. This validator catches that and every other RFC 8259 violation directly in your browser. Paste your JSON to get an immediate verdict: valid or invalid, with the exact line and column of any problem. Nothing is uploaded. No account required.

How to Validate JSON

  1. Paste or type your JSON into the input box.
  2. The validator checks syntax in real time, or click Validate for a full report.
  3. If valid, a green indicator confirms the structure with a summary of the top-level type.
  4. If invalid, the error panel shows the exact line, column, and a plain-English description of the problem.
  5. Fix the indicated issue and re-validate until you receive a clean result.

What Gets Checked

Structural Rules

JSON must begin with either an object ({}) or an array ([]) at the top level, though RFC 8259 also permits primitives (strings, numbers, booleans, null) as top-level values. Braces and brackets must be balanced and properly nested. Commas must separate elements but must not appear after the last element β€” trailing commas are the most frequent JSON error. Each object key must be a double-quoted string.

Value Types

JSON defines six value types: strings (double-quoted, with specific escape sequences), numbers (integers and decimals, no leading zeros), booleans (true and false, lowercase only), null (lowercase), objects, and arrays. JavaScript-specific values such as undefined, NaN, Infinity, and function expressions are not valid JSON and will fail validation.

RFC 8259 Compliance

RFC 8259 (published December 2017, superseding RFC 4627 and RFC 7159) is the current IETF standard for JSON. It specifies UTF-8 encoding, prohibits duplicate object keys, and defines exact escape sequences for string values. This validator enforces strict RFC 8259 rules for maximum compatibility across all parsers and languages.

Example

Invalid Input (trailing comma)

{
  "name": "Alice",
  "roles": ["admin", "editor",]
}

Validator Error

Error at line 3, column 33: Unexpected token ']'
Trailing commas are not permitted in JSON arrays (RFC 8259 Β§5).

Common Syntax Errors

  • Trailing comma β€” {"a": 1,} β€” remove the last comma before the closing brace or bracket
  • Single-quoted strings β€” {'key': 'value'} β€” change to double quotes
  • Unquoted keys β€” {key: "value"} β€” wrap the key in double quotes
  • JavaScript comments β€” // comment or /* comment */ β€” JSON has no comment syntax; remove them
  • Incorrect boolean/null casing β€” True, False, NULL are invalid; use true, false, null

Difference Between Validation and Formatting

Validation checks whether JSON is syntactically correct β€” it passes or fails with specific error details. Formatting only adds whitespace for readability and does not verify correctness. Attempting to format invalid JSON also fails, because the formatter has to parse the JSON first. Validate first, then format.

Once JSON passes validation, the JSON Formatter indents it for readability, and the JSON Minifier compresses it for production use. For URL-embedded JSON, decode with the URL Decoder before validating.

Frequently Asked Questions

What is the difference between JSON validation and formatting?

Validation checks whether your JSON is syntactically correct per RFC 8259. Formatting only adds whitespace for readability and does not verify correctness. You can attempt to format invalid JSON, but the formatter will also fail because it must parse the JSON first. Validate before formatting.

Why does JavaScript accept my JSON but the validator rejects it?

Some JavaScript environments accept relaxed JSON supersets like JSON5 or HJSON, which allow comments, single-quoted strings, and trailing commas. This validator tests against strict RFC 8259 to ensure the JSON works in all languages and runtimes. If your use case is only JavaScript, consider JSON5.parse() with the json5 library.

Can I validate JSON Schema documents with this tool?

This tool validates JSON syntax only, not JSON Schema semantics. A JSON Schema document is itself valid JSON, so syntax validation works. To validate whether a data object conforms to a JSON Schema definition, you need a dedicated JSON Schema validator such as ajv.

Is my data private when I validate it here?

Completely. Validation runs client-side in your browser using the native JSON.parse function. No data is sent to any server, logged, or stored. You can safely validate payloads containing API credentials, personal information, or internal business data.

What are the most common JSON validation errors?

In order of frequency: (1) trailing commas after the last element β€” [1, 2, 3,]; (2) single-quoted strings instead of double-quoted; (3) unescaped backslashes or control characters inside strings; (4) JavaScript comments; (5) uppercase True/False/Null instead of true/false/null.