ShotMark
Skip to Content

JSON Validator

Paste JSON and instantly see if it's valid, with the exact line and character of any error.

JSON Input
Formatted
Waiting for input

What is JSON Validator?

A JSON validator is a tool that parses a JSON document against the official grammar and reports whether the input is syntactically correct, along with the exact line and character of any error. It does not interpret meaning, modify data, or check business rules, only whether the bytes form a valid JSON value as defined in RFC 8259 and ECMA-404.

This JSON validator parses your input the moment you paste it and prints a green confirmation with the pretty-printed result, or a red error message naming the parser’s exact complaint. QA engineers, backend developers, and integration teams use it to triage broken webhook payloads, malformed config files, and API responses that fail downstream parsers without an obvious reason.

Why use this JSON validator?

  • Pinpoint the failing character. The validator surfaces the native parser’s error message, which usually includes a position like Unexpected token } in JSON at position 142, so you can jump straight to the offending byte.
  • Confirm validity before shipping. Run config files, fixture data, and OpenAPI examples through the validator before committing to catch trailing commas and unquoted keys that break production parsers.
  • Diagnose webhook failures. Drop the raw payload from a failed webhook delivery and see immediately whether the producer sent malformed JSON or whether the consumer is the problem.
  • Stay private by default. Validation runs entirely in your browser using the native JSON.parse API. The input never leaves your device, so secrets in payloads stay local.
  • Get a pretty-printed copy for free. Valid input is reformatted with two-space indentation and a one-click Copy button, ready to paste into a bug report or pull request.

How to use the JSON validator

  1. Paste your JSON into the JSON Input textarea.
  2. Read the result panel below: a green Valid JSON banner with the formatted output, or a red Invalid JSON banner with the parser error.
  3. If the input is invalid, locate the position from the error message, fix the syntax, and repaste.
  4. When the input is valid, click the Copy button on the result panel to copy the formatted JSON.
{ "user": { "id": 12, "email": "a@example.com" }, "active": true }

A common failure looks like this:

Unexpected token , in JSON at position 47

The comma at position 47 is usually a trailing comma after the last property or array element, which RFC 8259 forbids.

What the JSON validator checks

The validator delegates to the browser’s native JSON.parse, which enforces the full RFC 8259 grammar. That covers structural rules, value types, escaping, and number format.

RuleValidInvalid
Keys must be double-quoted strings{"id": 1}{id: 1}
No trailing commas[1, 2][1, 2,]
Strings use double quotes only"hello"'hello'
No comments{"a": 1}{"a": 1 // note}
Numbers follow JSON grammar3.14, -2.5e100x1F, .5, 1.
No undefined or NaNnullundefined, NaN
Unicode escapes use four hex digits"é""\uXY"
One root value per document{...}{...}{...}

The validator does not check JSON Schema, OpenAPI contracts, or business rules. For those, use a Schema-aware validator like Ajv or a contract-testing tool.

Common JSON errors and how to fix them

Every parser error in the Invalid JSON panel maps to a small set of mistakes. The position number in the error message counts characters from the start of the input, including whitespace and newlines.

SyntaxError: Unexpected token } in JSON at position 84

This usually means a trailing comma right before the closing brace. Remove the comma.

SyntaxError: Unexpected end of JSON input

The parser ran out of input before the structure closed. Check for a missing } or ].

SyntaxError: Unexpected token ' in JSON at position 12

A single quote appeared where a double quote was expected. JSON does not allow single-quoted strings, so replace them. The same error fires for unquoted keys ({name: "Ada"}), where the parser hits the colon expecting a string literal.

SyntaxError: Unexpected non-whitespace character after JSON at position 156

There is a second top-level value after the first. JSON allows exactly one root value per document. If you have a stream of JSON objects, switch to NDJSON (one object per line) or wrap them in an array.

Common use cases

  • QA engineers triaging broken integrations. Paste the failing webhook body to confirm whether the producer or consumer is at fault.
  • Backend developers debugging serializers. Validate the JSON your service emits after a refactor to catch escaping regressions before they hit a client.
  • DevOps engineers checking config files. Validate package.json, tsconfig.json, and CI config snippets before committing to avoid red builds.
  • API consumers writing fixtures. Confirm hand-edited test fixtures parse cleanly so flaky tests do not mask real bugs.
  • Tech writers maintaining docs. Verify example payloads in API documentation are still valid after edits.

JSON validator vs alternatives

ToolBest forOfflineCostLimitations
Browser DevTools consoleQuick one-off JSON.parse testYesFreeNo formatted output, no UI for large payloads.
jq -e . (CLI)Scripted batch validationYesFreeRequires jq installed; terse error messages.
Ajv + JSON SchemaValidating against a schema, not just syntaxYesFreeRequires writing a schema first.
This JSON validatorPaste, validate, and get formatted outputYes (in browser)FreeSyntax only; no schema validation.

Frequently asked questions

How do I know if my JSON is valid?

Paste it into the JSON validator. A green Valid JSON banner with formatted output means the input conforms to RFC 8259. A red Invalid JSON banner names the failing position and gives the native parser’s error message, which is enough to locate most issues within a few seconds.

What is the difference between a JSON validator and a JSON formatter?

A JSON validator checks whether the input conforms to the JSON grammar and reports errors. A JSON formatter rewrites valid JSON with consistent indentation for readability. This tool does both: it validates first, then prints the formatted output when the input is valid.

Does the validator check against a JSON Schema?

No. It validates syntax only, which is what RFC 8259 defines. To check that a payload matches a contract (required fields, types, enums), use a JSON Schema validator like Ajv or a contract-testing library. Syntax validation is a prerequisite for schema validation, not a replacement for it.

Why is my JSON invalid when it looks fine?

The most common causes are trailing commas after the last array or object item, single quotes around strings or keys, unquoted keys, comments, and undefined or NaN values. All five are common in JavaScript object literals but forbidden in strict JSON. The error position from the validator usually points to the exact character.

Is JSON with comments valid?

No. RFC 8259 does not allow comments. Variants like JSONC (used in VS Code config files) and JSON5 do allow them, but the parser in this validator follows the strict spec and will reject any // or /* */ comment. Strip comments before pasting, or use a JSONC-aware parser.

How large a payload can I validate?

The validator handles documents up to several megabytes without trouble. Beyond about 50 MB, parsing and DOM rendering can slow the tab. For very large files, validate a representative subtree instead of the whole document, or run a CLI parser like jq on the file directly.

Does NDJSON or JSON Lines validate here?

No. NDJSON is a stream of JSON values separated by newlines, which is two or more root values per document. The validator expects exactly one root value, so it will report Unexpected non-whitespace character after JSON. Wrap your NDJSON in an array, or validate one line at a time.

Can I trust the parser’s error position?

Mostly yes. The position counts characters from byte zero, including whitespace and newlines. Some browsers report a slightly different offset depending on how they normalize CRLF line endings. Use the position as a starting point, then scan a few characters before and after for the actual syntax mistake.

  • JSON Formatter & Diff: Pretty-print JSON and compare two payloads with a structured diff.
  • JSON Minifier: Strip whitespace and compress JSON to its smallest valid form.
  • JSON Compare: Deep-compare two JSON objects and see added, removed, and changed keys.
  • CSS Validator: Validate CSS syntax against the W3C specification.
Like this tool?

ShotMark captures what you do here, in one click.

The traces, payloads, and tests you run by hand? ShotMark grabs the whole bug and hands it to your AI agent.

Private beta accessFounding pricing lockNo spam ever