JSON
Pretty-print on the JSON formatter. Schema on JSON Schema. Dialect on the JSON5 validator.
Validation
Valid
Valid RFC 8259 JSON.
Primary output is this report - not pretty-printed JSON. Copy copies the report.
JSON Validator - RFC 8259 Syntax, Line and Column
Default {"ok":true} is valid. A trailing comma is not. This page does not pretty-print and does not apply a schema.
What Is a JSON Validator?
A JSON validator answers one question: does this text parse as RFC 8259 / ECMA-404? The primary output on this page is valid or the first line and column of failure. It is not a pretty-printer. It is not a JSON Schema engine. Copy copies the validation report, not an indented twin of your document. After the text parses, use the formatter if you want whitespace, and the schema validator if you want types and required keys.
The default {"ok":true} is valid. {"ok":true,} is not. {a:1} is not JSON and is JSON5 - that contrast belongs on the JSON5 page. Duplicate keys do not error in browsers; the later value wins. Large integers round as IEEE-754 doubles. Those are language limits, not extra lint rules this page invented.
Implementation is parseJsonDocument from the shared JSON lab: a trim check, then JSON.parse, then a line and column derived from the engine’s position when parse throws. Empty paste is not valid JSON; you get a prompt to paste something. Comments, single quotes, and trailing commas fail on purpose. That is the JSON specification, not a bug in the validator.
A document can be perfectly valid RFC 8259 and still be the wrong shape for your API. {"age":"21"} parses. A schema that requires integer age will reject it. Keep those tools separate so an incident write-up does not confuse a comma error with a type error.
Line and column come from parseJsonDocument, which wraps JSON.parse and maps the engine’s position (or a line/column phrase) onto the original text. The first error wins. Later mistakes stay hidden until you fix this one. That is how JSON parsers work; this page does not invent a second pass. Copy copies that report so you can paste it into a ticket without implying that the payload was pretty-printed or schema-checked.
Numbers are IEEE-754 doubles in browsers. A 64-bit integer that does not fit will round even when the text is valid JSON. Duplicate keys are accepted and the last value wins. Neither case produces an Invalid report here, because the language parse succeeded. If those limits matter for your product, add a dedicated linter or compare keys yourself after this page says valid.
How to Validate JSON Syntax - Step by Step
Syntax checking is live as you type:
- Paste JSON - The default
{"ok":true}is valid. Keep it to see a passing document, or replace it with any text you want to check against RFC 8259. - Read valid or the error - The right panel shows Valid RFC 8259 JSON, or Invalid JSON at line and column with the parser message. A trailing comma such as
{"ok":true,}fails. - Fix the first error and re-check - Parsers stop at the first problem. Repair that location, then read the panel again. Copy copies the report, not pretty-printed JSON.
- Pretty-print or apply a schema only after it parses - Use the JSON formatter for indent, and the JSON Schema validator for contracts. This page’s job is syntax only.
- Use JSON5 only when you meant JSON5 - Unquoted keys and comments are invalid here. Open the JSON5 validator if that dialect is the source of truth.
- Move huge files off this textarea - A 50 MB dump belongs on the JSON file processor. This panel is for documents you are willing to keep as a string in the page.
JSON Validation Example - Valid Default vs Trailing Comma
The worked check on this page is a two-line object. Changing one character is enough to fail RFC 8259.
Valid - default sample
{
"ok": true
}Result: Valid RFC 8259 JSON. The right panel does not indent this further. Indent is the formatter’s job.
Invalid - trailing comma
{"ok": true,}Result: Invalid JSON at a line and column near the extra comma. JavaScript object literals allow trailing commas. JSON does not. That is the most common paste error from a .js or .ts file.
Invalid JSON, valid JSON5 - unquoted key
{a: 1}This page reports invalid. The JSON5 validator accepts it. If your source of truth is JSON, quote the key. If your source of truth is JSON5, use that page instead of fighting this one.
When You Need a JSON Syntax Validator - Real-World Use Cases
Catching trailing commas before a deploy
Config files copied from JavaScript often pick up a last comma. CI then fails on JSON.parse in a language that is not JavaScript. Pasting here names the line and column so you do not grep a minified one-liner by eye.
Separating parse failures from schema failures
Support tickets that say “invalid JSON” are often schema errors. If this page says valid, the text is JSON. The next question is the contract on the JSON Schema validator. If this page says invalid, do not waste time on types - fix the comma, quote, or bracket first.
Checking a payload before you pretty-print
The formatter will refuse to indent invalid text, but its job is presentation. This validator’s job is the report. Copy the line/column message into a ticket without producing a formatted document that might be mistaken for “the API response.”
Rejecting JSON5 extensions on a JSON-only API
Unquoted keys, comments, and single-quoted strings are convenient in editors. They are illegal on the wire for RFC 8259 APIs. This page fails them on purpose so you do not ship a dialect the server cannot parse.
Teaching the JSON grammar without a schema
Students can keep {"ok":true}, then try True, 'ok', and a trailing comma. Each failure is a grammar lesson. Schema keywords would confuse that lesson. Keep the default, then break it.
Sanity-checking a clipboard paste
Chat apps wrap JSON in smart quotes or ellipses. The first error location is usually near the damaged character. Fix that character, re-check, then move on. You do not need Ajv for a curly quote.
Knowing duplicate keys will not save you
Two ok keys parse. The last value wins. This validator will not flag that, because browsers do not. If uniqueness matters, inspect keys yourself or use a stricter linter. Do not assume “valid” means “no duplicate names.”
Keeping huge files off the syntax textarea
A 50 MB dump will parse in a worker on the file processor. This textarea is the wrong intake. Validate a sample here, or parse the file there. Mixing those jobs freezes the tab.
Validator vs Formatter vs Schema vs JSON5
Four nearby tools. The primary output of this page is the report, not indented JSON:
| Need | This validator | JSON formatter | JSON Schema | JSON5 |
|---|---|---|---|---|
| RFC 8259 parse | ✓ primary | Side effect | Assumes JSON | Different dialect |
| Line and column of first error | ✓ | Parser message | instancePath | JSON5 errors |
| Pretty-print / minify | No | ✓ | No | No |
Default {"ok":true} valid | ✓ | Would format it | Needs a schema | Also parses |
| Trailing comma | Invalid | Invalid | Parse fails first | Allowed |
| Unquoted keys | Invalid | Invalid | Parse fails first | Allowed |
| Integer age contract | Out of scope | Out of scope | ✓ | Out of scope |
| Copy primary output | The report | Indented JSON | Valid / errors | Dialect report |
The general rule: parse here, indent on the formatter, contract on schema, dialect on JSON5.
Common JSON Syntax Errors - What This Validator Catches
These are RFC 8259 failures. They are not schema failures. The first error wins; later errors stay hidden until you fix this one:
- Trailing commas.
{"ok":true,}and[1,2,3,]are invalid JSON. They are valid JavaScript. - Single quotes.
'ok'is not a JSON string. Use double quotes. - Unquoted keys.
{a:1}is JSON5. Quote the key for JSON. - Comments.
//and/* */are not in RFC 8259. Strip them or use JSON5 if comments are required. - Unclosed brackets or braces. Every opening
{or[needs a matching close. The reported column is near where the parser gave up, which may be the end of the file. - Wrong literals.
True,FALSE, andNULLare invalid. JSON literals are lowercasetrue,false,null. - Invalid escapes. Only JSON string escapes are legal. A stray backslash fails parse.
- Empty input. Paste JSON to validate. Whitespace-only text is not a document.
- Duplicate keys. Not reported. Last value wins. That is a browser
JSON.parselimit, not a green check for uniqueness.
Privacy & Security - JSON.parse in the Browser
Validation is a local parse. The document is not posted to a server. That makes the page usable for tokens, customer records, and internal configs - with the usual shared-device caveat for localStorage drafts.
The textarea is saved under a unique storage key for up to 30 days. Click Clear to restore {"ok":true}. Panel width is stored separately. Copy copies the report string, not a pretty-printed secret dump. Huge files should never be pasted here; use the file processor so the payload is not persisted as a draft.
Frequently Asked Questions
How is this different from the JSON formatter?
The formatter’s job is pretty-print and minify. This validator’s primary output is valid or the first line and column error. It will not pretty-print as the main result. After the document is valid, use the formatter if you want indented text.
What does the default sample do?
{"ok":true} parses. {"ok":true,} is invalid RFC 8259. {a:1} is invalid JSON and valid JSON5 - use the JSON5 validator for that dialect. Keep the default to see a passing document, then add a trailing comma to see line and column.
Does it check a JSON Schema?
No. Schema contracts live on the JSON Schema validator. This page only asks whether the text is JSON. A document can be perfectly valid RFC 8259 and still fail a schema that requires integer age.
Is duplicate-key JSON valid?
JSON.parse accepts it and keeps the last value. RFC 8259 recommends unique keys but parsers in browsers do not error. This tool cannot recover the discarded key. If uniqueness matters, check in a stricter linter or compare object keys yourself.
Does validation upload the document?
No. parseJsonDocument runs locally. The draft stays in localStorage for up to 30 days. Click Clear to restore {"ok":true}. Do not leave production secrets on a shared device.
Can I validate a 50 MB file here?
Use the JSON file processor. This textarea is for documents you are willing to keep as a string in the page. A huge dump belongs in a worker with a documented size cap, not in this validator’s input panel.
What JSON specification does this follow?
RFC 8259 / ECMA-404, via the browser’s JSON.parse wrapped by parseJsonDocument so the first error includes line and column when the engine reports a position. Comments, single quotes, and trailing commas are invalid. JSON5 is a different dialect on a different page.
Does this pretty-print JSON?
No. The primary output is Valid RFC 8259 JSON or an Invalid JSON message with line and column. Pretty-print is a different job on the JSON formatter. Copy on this page copies the validation report, not an indented document.
What is the difference between JSON and JSON5?
JSON5 allows unquoted keys, trailing commas, comments, and single-quoted strings. Those documents fail here on purpose. If you meant JSON5, use the JSON5 validator. If you meant JSON, strip those extensions first.
Is this JSON validator free?
Yes. No signup, no parse quota, and no upload. Validate as much RFC 8259 JSON as you need. Processing stays in the browser.
Related JSON Syntax & Contract Tools
Syntax is the first gate. These pages cover indent, contracts, dialect, and files:
- JSON Formatter - Pretty-print and minify after the document is valid RFC 8259.
- JSON Schema Validator - Types, required keys, and draft 2020-12 contracts. Default age 21 is a different check.
- JSON5 Validator - Unquoted keys, trailing commas, and comments. Not RFC 8259.
- JSON Repair - Heuristic fixes for small broken drafts before you re-validate here.
- JSON File Processor - Worker parse for files up to the documented 50 MB cap.
- JSON Minifier - Compact valid JSON. Invalid text cannot minify.
- JSON Compare - Diff two documents after both parse.
- JSON Editor - Edit a valid document as text or a table.
Related Tools
Discover more free developer tools that might interest you.
JSON5 Validator
Validate JSON5 (comments, trailing commas, unquoted keys)
Use ToolCSS Validator
Parse CSS and report syntax errors with locations
Use ToolJavaScript Validator
Parse JavaScript syntax with Acorn. Does not run the code
Use ToolXML Validator
Check that XML is well-formed. Not a full XSD or DTD validator
Use ToolYAML Validator
Parse YAML documents and report syntax errors
Use ToolCredit Card Validator
Luhn checksum and brand from IIN prefix. Format check only, numbers are not stored
Use ToolRelated guides
Read the how-to, then come back to this tool when you are ready to run it locally.
- A JSON Validator Is Not JSON Schema (RFC 8259 vs a Contract)Valid JSON can still be the wrong document. Syntax (RFC 8259) is not draft 2020-12 schema. When to open DevOkk’s JSON validator, JSON Schema validator, or formatter - and what duplicate keys still hide.
- JSON vs JSON5: What Validators Accept (and What APIs Will Reject)JSON5 allows comments, unquoted keys, trailing commas, and single quotes. RFC 8259 does not. How DevOkk’s JSON validator and JSON5 validator disagree on purpose, and when Infinity becomes null.