NV ToolkitFormat · Validate · Convert

JSON Tools

JSON5 Validator

Validate JSON5 with precise errors — and get the strict-JSON equivalent of your document in the same click.

In short

Validate JSON5 online with exact error positions, and get the equivalent strict JSON output for APIs and parsers that don't speak JSON5. Free, private.

By NaveenKumar T · Updated

Learn: Comments in JSON: Why They're Forbidden and What To Do Instead

  • Full JSON5 grammar validation
  • Exact error line & column
  • Outputs strict JSON equivalent

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Example

JSON5 Validator: input and output

A build config for a JS bundler — comments and trailing commas make it pleasant to hand-edit, but tooling downstream usually wants plain JSON.

Input · javascript
{
  // Build config for the widget bundle
  target: 'es2022',
  sourceMaps: true,
  entry: ['src/index.ts',],
  external: ['react', 'react-dom',],
  minify: false,
}
Output · json
{
  "target": "es2022",
  "sourceMaps": true,
  "entry": [
    "src/index.ts"
  ],
  "external": [
    "react",
    "react-dom"
  ],
  "minify": false
}

The comment and every trailing comma disappear, single quotes become double, and bare keys get quoted — the strict JSON a bundler or API actually expects, generated straight from the JSON5 you hand-wrote.

Learn more

Validate JSON5, ship JSON

The common JSON5 workflow is asymmetric: humans write JSON5, machines consume strict JSON. This validator serves exactly that flow — paste the config you edited, get a green badge plus the strict-JSON form, with comments and conveniences compiled away. Parse errors report the precise line and column, which matters in comment-heavy configs where the broken token hides mid-file.

The tree view shows the parsed data structure, making it easy to confirm that an unquoted key or special number resolved to what you intended before the file ships.

What each JSON5 feature becomes in JSON
JSON5 inputStrict JSON output
// or /* */ commentRemoved
'single-quoted string'"double-quoted string"
0xFF255
.50.5
5.5.0
Trailing commaRemoved
+11
unquotedKey: 1"unquotedKey": 1

Help

Frequently asked questions

Everything you need to know about the JSON5 Validator.

01What does the validator output when my JSON5 is valid?

The strict-JSON equivalent of your document: comments dropped, keys quoted, single quotes converted, trailing commas removed, special numbers normalized. Valid JSON5 in, portable JSON out — ready for any API or parser.

02Why does my config validate here but fail in my app?

Your app is probably parsing it as strict JSON. JSON5 features — comments, unquoted keys, trailing commas — require a JSON5 (or JSONC) parser. Either ship the converted JSON this tool produces, or switch the app to a JSON5 parser.

03Does JSON5 validation catch the same errors as JSON validation?

It catches REAL errors — unclosed strings, mismatched brackets, malformed numbers — while accepting the human-friendly syntax JSON forbids. If you need to know whether a document is strict-JSON clean, use the JSON Validator instead; the two tools enforce different grammars on purpose.

04How do I convert JSON5 to JSON in Node or a build script?

The json5 npm package plus one line does it: after npm i json5, JSON.stringify(JSON5.parse(text)) parses with the JSON5 library and serializes with the standard JSON one, producing the same strict-JSON output this page shows. That one-liner is what most build steps use to compile a hand-edited JSON5 config down to JSON before it ships.

05Does the validator accept NaN, Infinity and hex numbers, and what do they become in JSON?

All three parse as valid JSON5 numbers. JSON has no representation for NaN or Infinity, so the strict-JSON output normalizes them the way JSON5 libraries commonly do — check the tree view for the exact value on your document before relying on it downstream. Hex numbers convert cleanly: 0xFF becomes the plain decimal 255, since JSON only has one number type.

Keep working

Related tools

Learn the format

Related guides

All guides →