Command Palette

Search for a command to run...

JS

JSON Validator

Validate JSON against RFC 8259 and get the exact line, column, and character of the first syntax error, plus duplicate-key detection and structure stats. Client-side, no signup.

Indent:
Category:data
Mode:Offline
Version:1.0.0
Access:Free

What is a JSON Validator?

A JSON validator checks whether a block of text is well-formed JSON and, when it is not, tells you exactly where the problem is. It parses the text against the JSON grammar defined in RFC 8259 and ECMA-404, and either confirms the document is valid or stops at the first character that breaks the rules, reporting the line, the column, and the character offset so you can jump straight to the mistake instead of reading the whole file by eye.

The reason a dedicated validator exists, rather than just calling the language built-in parser, is that the error a built-in parser gives you is often useless. JSON.parse in a browser reports "Unexpected token in JSON at position 148" with no line number, and the position it names is frequently a few characters past the real fault. This tool walks the text itself, keeps track of line and column as it goes, and phrases the error in terms of what it expected: a comma after a member, a closing brace, a double-quoted key. A trailing comma, a single-quoted string, an unescaped tab inside a string, a leading zero on a number, and two members with no comma between them are all called out by name.

Validity is only half of what you usually need to know, so a valid document also comes back with a report. The tool lists any duplicate keys, which the standard permits but which almost always mean a bug, because a normal parser keeps only the last value and drops the rest silently. It counts objects, arrays, keys, and each kind of scalar, measures the maximum nesting depth, and reports the size in both characters and UTF-8 bytes, so you can see the shape of an unfamiliar payload at a glance. When the JSON is valid it is also pretty-printed, giving you a clean, indented copy in the same step.

Everything runs in your browser. The text you paste is parsed in JavaScript on your own machine and is never uploaded, logged, or stored, which matters because the JSON people most need to validate is often an API response or a config file carrying tokens, keys, or personal data. Because there is no server round trip, the validator is instant and keeps working with the network disconnected once the page has loaded.

How to use the JSON Validator?

1

Paste your JSON

Paste the JSON you want to check into the input box, or load the sample. Any value is accepted at the top level: an object, an array, or a single string, number, boolean, or null.

2

Set the options

Leave duplicate-key detection on to be warned about repeated keys, and pick the indentation used for the pretty-printed copy of a valid document: two spaces, four spaces, or a tab.

3

Validate

Click Validate. A valid document shows a green result with the statistics and any duplicate-key warnings; an invalid one shows the error message with the exact line and column and a caret under the offending character.

4

Fix and copy

Use the reported position to fix the error, then re-validate. Once the JSON is valid, copy the pretty-printed output or read off the structure stats.

Key Features

Exact error position

The first syntax error is reported with its line, column, and character offset, plus a caret drawn under the exact character, so you find the fault immediately instead of guessing from an opaque position number.

Plain-language messages

Errors are named for what went wrong: a trailing comma, a single-quoted string, a missing comma between members, an unescaped control character, or a number with a leading zero, rather than a generic "unexpected token".

Duplicate-key detection

Repeated keys in the same object are listed with their line and a JSON Pointer path. The standard allows them, but a parser silently keeps only the last, so a duplicate is almost always a real bug worth surfacing.

Structure statistics

A valid document reports its object, array, key, and scalar counts, its maximum nesting depth, and its size in characters and UTF-8 bytes, so you can size up an unfamiliar payload at a glance.

Frequently Asked Questions

JSON is valid when it follows the grammar in RFC 8259: one top-level value, strings in double quotes, no trailing commas, no comments, and numbers without leading zeros or a trailing decimal point. A validator confirms the whole document obeys those rules and stops at the first place it does not.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

json validatorvalidate jsonjson checkerjson syntax checkerjsonlint alternativejson error findercheck json onlinejson linteris my json valid