Skip to content

JSON Validator

Result —
Parser message
—
Error position
—
Top-level type
—
Objects
—
Arrays
—
Keys
—
Values (strings, numbers, literals)
—
Nesting depth
—

Paste JSON and the validator parses it with strict RFC 8259 rules. Valid input shows its top-level type, key count and nesting depth; invalid input shows the first error with its position, for example {"a": 1,} fails at line 1, column 9 with a trailing comma before the closing brace.

About this tool

A config file that will not load or an API request rejected with a 400 often comes down to one stray character: a trailing comma, a single quote, a comment someone left in. This validator reads the text the way a strict parser does and stops at the first problem, naming the line, the column and what it expected instead. When the text is valid, it reports the structure: how many objects, arrays and keys it holds and how deeply they nest, and it flags duplicate keys, which the standard allows but most parsers silently collapse. It checks syntax only. It does not test the data against a JSON Schema, so a missing required field or a wrong type will still pass.

How to use it

  1. Add the JSON

    Paste it into the box, type it, or open a .json or .txt file from your device.

  2. Read the verdict

    The result shows Valid JSON or Invalid JSON and updates as you edit.

  3. Go to the error

    For invalid input, jump to the reported line and column; the working also quotes that line.

  4. Fix and recheck

    Correct the character, and the parser moves on to the next problem, if any.

Examples

RFC 8259 address list

JSON to check
[ { "precision": "zip", "Latitude": 37.7668, "Longitude": -122.3959, "Address": "", "City": "SAN FRANCISCO", "State": "CA", "Zip": "94107", "Country": "US" }, { "precision": "zip", "Latitude": 37.371991, "Longitude": -122.026020, "Address": "", "City": "SUNNYVALE", "State": "CA", "Zip": "94085", "Country": "US" } ]

Result Result: Valid JSON
Parser message: No errors
Error position: None
Top-level type: Array
Objects: 2
Arrays: 1
Keys: 16
Values (strings, numbers, literals): 16
Nesting depth: 2

  1. Parsed 388 characters with strict RFC 8259 rules: double-quoted keys and strings, no comments, no trailing commas.
  2. Top-level value: Array; 2 objects, 1 arrays, 16 keys, nesting depth 2.

The array from the JSON standard itself: two objects, sixteen keys, nested two levels deep.

A trailing comma

JSON to check
{"a": 1,}

Result Result: Invalid JSON
Parser message: Trailing comma before }
Error position: Line 1, column 9

  1. Parsed 9 characters with strict RFC 8259 rules: double-quoted keys and strings, no comments, no trailing commas.
  2. Stopped at line 1, column 9: Trailing comma before }.
  3. Line 1: {"a": 1,}

JavaScript accepts a comma after the last member, JSON does not; the parser stops at the closing brace in column 9.

Single-quoted keys

JSON to check
{ 'id': 7 }

Result Result: Invalid JSON
Parser message: Expected a double-quoted key, found "'"
Error position: Line 2, column 3

  1. Parsed 13 characters with strict RFC 8259 rules: double-quoted keys and strings, no comments, no trailing commas.
  2. Stopped at line 2, column 3: Expected a double-quoted key, found "'".
  3. Line 2: 'id': 7

Keys copied from Python or JavaScript often use single quotes. JSON requires double quotes, so line 2 fails at the first quote.

How it is calculated

value = object | array | string | number | true | false | null, parsed left to right

object
{ } holding double-quoted keys, each followed by a colon and a value, separated by commas
array
[ ] holding values separated by commas
line, column
position of the first character the grammar cannot accept, both counted from 1

The parser follows the grammar in RFC 8259. Whitespace is only space, tab, line feed and carriage return. Strings must use double quotes, escape control characters and use only the escapes \" \\ \/ \b \f \n \r \t and \u plus four hex digits. Numbers may not have leading zeros, a leading plus sign or a bare decimal point. Comments, trailing commas, NaN and Infinity are rejected. Any text after the top-level value is an error.

When not to use it

  • To confirm data matches a contract such as required fields or value types, use a JSON Schema validator.
  • For JSON5, JSONC or YAML files that allow comments, a strict JSON check will report errors those formats permit.

Common mistakes

  • Leaving a comma after the last item of an object or array.
  • Using single quotes or unquoted keys copied from JavaScript code.
  • Writing NaN, Infinity or undefined, none of which exist in JSON.

Frequently asked questions

Why does it report only one error?

A parser cannot reliably know what the rest of the text means once the grammar breaks, so later messages are often noise. Fix the reported character and the check runs again, showing the next problem if there is one.

Are comments allowed in JSON?

No. RFC 8259 has no comment syntax, so // or /* */ is reported as an unexpected character. Formats such as JSONC, used by some editor settings files, allow them, but standard parsers will reject those files.

Is a duplicate key an error?

The standard says names within an object should be unique but does not forbid repeats. The text still parses, so it is reported as valid with a warning, because most libraries keep only the last value and silently drop the earlier one.

Can the top level be a number or a string?

Yes. Since RFC 7159, any JSON value may stand alone, so 42 or "hello" is valid JSON text. Some older APIs still expect an object or array at the top.

How are line and column counted?

Both start at 1. Lines break at each line feed, and the column counts characters from the start of that line, so a tab counts as one column even if your editor shows it wider.

Is my JSON sent to a server?

No. Parsing runs in your browser, and an opened file is read locally. That matters when the JSON holds tokens or customer records.

Cite this tool

Using this tool in an assignment, article or report? Copy a citation, or a link for your website.

APA

Tools Directory Editorial Team. (2026, October 28). JSON Validator. Tools Directory. Retrieved October 28, 2026, from https://tools.milunir.com/developer-tools/json-tools/json-validator/

MLA

Tools Directory Editorial Team. “JSON Validator.” Tools Directory, 28 Oct. 2026, https://tools.milunir.com/developer-tools/json-tools/json-validator/. Accessed 28 Oct. 2026.

Chicago

Tools Directory Editorial Team. “JSON Validator.” Tools Directory. Last modified October 28, 2026. Accessed October 28, 2026. https://tools.milunir.com/developer-tools/json-tools/json-validator/.

Link<a href="https://tools.milunir.com/developer-tools/json-tools/json-validator/">JSON Validator – Tools Directory</a>