Skip to content
HandyKit

JSON Validator

Paste or open JSON to check it as you type. Errors show their line, column and a suggested fix; valid JSON gets a summary of its structure.

Runs in your browser. Your input is never uploaded or stored.

Validation result

Paste or open JSON to check it. The result appears here.

What makes JSON valid?

JSON is defined by RFC 8259, and its rules are stricter than JavaScript's. A document is valid JSON when:

  • Strings and property names use double quotes. 'single' quotes are not allowed.
  • There are no trailing commas after the last item of an object or array.
  • There are no comments. JSON has no // or /* */ syntax.
  • true, false and null are lowercase. True, None, undefined and NaN are not JSON.
  • Numbers are written in decimal, without leading zeros, a leading +, or hexadecimal like 0x1F.
  • Special characters inside strings are escaped: a line break is \n, a tab is \t, a backslash is \\.
  • The text holds exactly one value. It can be an object, an array or a single scalar such as 42.

How to validate JSON

  1. Paste your JSON into the editor, select Open file, or drop a file onto it.
  2. The result appears as you type. Valid JSON shows a summary of its structure.
  3. If there is an error, it is underlined in the editor. The message shows its line and column, with a suggested fix. Show in input moves your cursor to it.
  4. Fix the error and the result updates. Only the first error is reported, because one mistake, such as a missing quote, can make everything after it unreadable.

What the validator reports

Syntax errors stop parsing: the validator reports the first one with its exact position, a plain-language message such as "Trailing comma before ]", and how to fix it.

Warnings are valid JSON that is likely to cause problems elsewhere:

  • Duplicate keys. The standard says keys should be unique, and parsers disagree about which value to keep.
  • Large integers. Numbers above 9,007,199,254,740,991 lose precision when read by JavaScript.
  • A byte-order mark. An invisible character at the start of the file that some parsers reject.

A structure summary for valid JSON: the type of the top-level value, how deeply it is nested, and how many objects, arrays, keys, strings, numbers, booleans and nulls it contains. It is a quick way to sanity-check an API response or a data export.

Syntax validation and JSON Schema

This validator answers one question: is this text valid JSON? It does not check whether the data has the shape your application expects, for example that email is present and is a string. That is the job of JSON Schema, which compares a document against a schema you write.

Validating JSON in code and on the command line

When you need to check JSON in a script or CI pipeline:

# jq: prints nothing and exits 0 when valid
jq empty data.json

# Python standard library
python3 -m json.tool data.json > /dev/null

In JavaScript, JSON.parse throws a SyntaxError for invalid input:

function isValidJson(text) {
  try {
    JSON.parse(text);
    return true;
  } catch {
    return false;
  }
}

Be aware that JSON.parse accepts duplicate keys and rounds large integers without warning. This page reports both.

Frequently asked questions

Is my JSON uploaded or saved anywhere?

No. Validation runs in this browser tab, and opening a file reads it on your device. Nothing is sent to a server, logged, or kept in browser storage.

Is a single string or number valid JSON?

Yes. The current standard, RFC 8259, allows any JSON value at the top level, including "hello", 42, true and null. The older RFC 4627 required an object or array, so a few very old parsers still reject bare values.

Are duplicate keys invalid?

Not strictly. RFC 8259 says names within an object should be unique, but does not forbid duplicates. Parsers handle them differently: most keep the last value, some keep the first, and some reject the document. That is why the validator accepts them and shows a warning.

Why does it warn about large numbers?

JSON allows integers of any size, but JavaScript stores numbers as 64-bit floats and can only represent integers up to 9,007,199,254,740,991 exactly. A larger ID will be silently rounded by JSON.parse in browsers and Node.js. Store such values as strings if JavaScript will read them.

Does it validate against a JSON Schema?

Not yet. This tool checks syntax: whether the text is JSON at all. JSON Schema checks structure, such as required fields and value types, and needs a schema to compare against.

Is JSON with comments valid?

No. Standard JSON has no comment syntax. Formats such as JSONC (used by VS Code settings) and JSON5 allow comments, but other JSON parsers will reject them. The JSON Formatter’s Repair button removes comments for you.

Guides

  • · 3 min read

    JSON Schema Explained, with Examples

    What JSON Schema is, the keywords you will use most, and how to read validation errors, with a worked example schema, a valid document and an invalid one.

  • · 4 min read

    Common JSON Errors and How to Fix Them

    Trailing commas, single quotes, comments, True and None: the JSON syntax errors developers hit most often, what each error message means, and how to fix it.