JSON Validator

Home
JSON ToolkitAll tools
Input
Output
34 lines · 782 bytesAll processing happens locally in your browser.

JSON Validator

Use this JSON validator to check API payloads, configuration files, and fixtures before they reach your application.

  • Paste an object or array to check JSON syntax.
  • Use the error message to locate malformed commas, quotes, and brackets.
  • Valid JSON can be copied as formatted output.

This tool runs entirely in your browser. Your JSON is not uploaded, stored, or logged.

Validate before you transform

Most JSON headaches start with invalid input: a trailing comma from a JavaScript object literal, single quotes, an HTML error page returned instead of JSON, or a log line accidentally appended to the response body.

Validate first. If the parser fails, fix that error before formatting, minifying, converting, or writing application code against the payload. Otherwise you waste time debugging a tool or serializer that never received legal JSON.

Common reasons JSON fails

JSON is stricter than a JavaScript object literal. These mistakes show up constantly in real payloads:

  • Single quotes instead of double quotes around keys or strings.
  • A trailing comma after the last item in an object or array.
  • Unquoted property names.
  • Comments (JSON has none).
  • A missing closing bracket, brace, or quote.
  • An HTML 404/500 page or plain-text warning mixed into the response.

How to read the error

When validation fails, read the message as a pointer: it usually tells you where the parser stopped understanding the document. Check that character and a few tokens before it — the real mistake is often a missing comma or quote just upstream of the reported position.

If the “JSON” starts with <!DOCTYPE or <html, you are not looking at JSON at all. Fix the request, auth, or route, then validate the real body.

Valid JSON is not the same as correct JSON

This validator (and JSON.parse) answers one question: is the document legal JSON? It does not know whether user_id should be a string, or whether status must be one of three values. A payload can pass here and still be wrong for your application.

That second layer is JSON Schema: a document describing the required shape, types, and allowed values. Checking syntax first is still the right order — a schema validator reports confusing errors on malformed input — but do not mistake one layer for the other.

The failures that do not look like failures

Some bad payloads pass or fail in ways that surprise people:

  • A UTF-8 BOM at the start of a file is common in editors and invalid to JSON.parse, which reports an error at position 0. Strip the BOM before pasting.
  • JSON accepts only the exact tokens true, false, and null. Python's True or None, or a stray undefined, fail as syntax errors rather than bad values.
  • Duplicate keys are legal but collapse to the last value, so the validator reports “valid” for a document that has already lost data.
  • Trailing content after the closing brace — a second object, a log line, a stray comma — is a parse error even when the first object was fine.

Frequently asked questions

What is the difference between validating and formatting?

Validation checks whether the document is legal JSON. Formatting rewrites valid JSON with readable indentation. Always validate (or confirm validity) before treating a pretty-printed result as trustworthy.

Why does my API return invalid JSON?

Often the endpoint returned an HTML error page, a debug print, or a truncated body under a gateway timeout. Validate the raw response first — the parser error shows where the document stopped being JSON.

Does this validator upload my payload?

No. Validation runs in your browser. Tokens, emails, and internal fields stay on your device.

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

The validator checks syntax — is this legal JSON. JSON Schema checks shape — are the types, required fields, and allowed values what your application expects. You usually want both, in that order.

Why does valid JSON still break my app?

Because the shape is wrong even though the syntax is fine — a field is null when the code expects a string, a required key is missing, or a number arrived as a string. That class of bug needs schema validation or a type check, not a syntax parser.

Related

Support the free tools