Skip to content

JSON Validator & Syntax Checker

Check whether a JSON payload parses and locate the first syntax error before posting the payload to an API or saving a config file.

Runs in your browser Free, no sign-up
Loading tool workspace...

What is JSON Validator?

This JSON validator checks whether a piece of JSON is syntactically valid. Paste an API response, configuration file or payload and it tells you straight away either that the JSON is valid or what the parser choked on, such as an unexpected token, a missing comma, a trailing comma or an unterminated string, usually with the position or line where it happened.

JSON is strict: keys must be in double quotes, strings cannot use single quotes, comments are not allowed, and the last item in an object or array cannot be followed by a comma. Code that accepts JavaScript objects often accepts these mistakes, but JSON parsers in every language reject them, so validating before you ship a config or send a payload saves a debugging session.

How to use JSON Validator

  1. Paste or type your JSON into the input box.
  2. Validation runs as you type: a green "Valid JSON syntax" message means the JSON parses.
  3. If it is invalid, read the error message, which names the problem and where it occurred.
  4. Fix the reported issue and repeat until it is valid; then use the JSON Formatter to pretty-print it.

Key features

  • Instant validation as you type
  • Precise parser error messages, with line and column in modern browsers
  • Strict RFC 8259 compliance via the native JSON.parse
  • Handles large JSON documents quickly
  • Runs entirely in your browser; nothing is uploaded

Common use cases

  • Checking API request and response bodies before debugging further
  • Validating package.json, tsconfig.json, composer.json and other config files
  • Finding the syntax error in hand-edited or generated JSON
  • Verifying JSON exported from databases or spreadsheets
  • Confirming that JSON produced by an LLM is valid before parsing it in code

Technical details & standards

Validation uses the browser's native JSON.parse, a strict implementation of RFC 8259 and ECMA-404, so anything it accepts will parse in other standards-compliant JSON libraries. The error text comes from the browser's parser; current Chrome and Edge versions include the line and column, and Firefox reports the line and column too.

The most common errors are: trailing commas after the last element, single-quoted strings, unquoted keys, comments (// or /* */), unescaped control characters or double quotes inside strings, and values such as NaN, Infinity or undefined, which JSON does not have. To repair JSON with many of these problems automatically, use the LLM JSON Fixer.

Check if a string is valid JSON in code

In scripts, the quickest JSON check is to parse it and catch the error. Each example rejects {"ok": true,} because of its trailing comma.

JavaScript

const isValidJson = s => { try { JSON.parse(s); return true; } catch { return false; } };
isValidJson('{"ok": true}');   // true
isValidJson('{"ok": true,}');  // false

Terminal

python3 -m json.tool data.json > /dev/null   # exit code 1 and the error position if invalid
jq empty data.json                           # prints nothing when the file is valid

Frequently asked questions

Why is my JSON invalid?

The usual culprits are a trailing comma after the last item, single quotes instead of double quotes, unquoted property names, comments, or an unescaped double quote inside a string. The error message points to the first problem the parser found; fix it and validate again.

Does JSON allow comments or trailing commas?

No. Standard JSON (RFC 8259) allows neither. Formats such as JSONC (used by VS Code settings) and JSON5 add them, but a standard JSON parser rejects both.

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

A JSON validator checks syntax: is this valid JSON at all? A JSON Schema validator checks structure: does valid JSON have the required fields and types described by a schema? Run the syntax check first.

Can it fix my JSON automatically?

This tool reports errors without changing your input. To repair common problems such as trailing commas, single quotes, comments, Python True/False/None or truncated output automatically, use the LLM JSON Fixer.

Is this a JSONLint alternative?

Yes. Like JSONLint, it parses your JSON with a strict parser and points to the first error, such as a trailing comma or a missing quote. It runs entirely in your browser, so nothing you paste is uploaded.

Is my data safe?

When you request a URL, your browser sends the request directly to that destination. CodeUnpack does not proxy the request.

Does it work offline?

Once the page has loaded, you can work with local input offline. Loading a URL requires a connection.

More validators & checkers tools

View all