JSON5 Validator

Check JSON5 with comments, trailing commas, single quotes and unquoted keys, see where it breaks, and convert it to plain JSON.

Processed on your device. Files are not uploaded

How to check JSON5

  1. Paste your JSON5

    Paste or type your JSON5 into the box, or press Try an example.

  2. Read the result

    Errors show the line and column.

  3. Copy the JSON

    The plain JSON works with any parser.

Worked example

This is what JSON5 Validator gives for its own sample values. Open the tool above and change anything to try your own.

JSON5

// app settings
{
  name: 'sarva',
  port: 3000,
  hosts: ['localhost', '127.0.0.1',],
  timeoutMs: 1.5e4,
  mask: 0xFF,
  debug: true, // trailing comma is fine
}
Output JSON indentation
2 spaces

Plain JSON

{
  "name": "sarva",
  "port": 3000,
  "hosts": [
    "localhost",
    "127.0.0.1"
  ],
  "timeoutMs": 15000,
  "mask": 255,
  "debug": true
}

When to use JSON5 Validator

A config file with comments fails to load and you need to know which line is wrong.

A tool that only reads strict JSON needs a JSON5 or JSONC file converted.

Tips for a better JSON5 Validator result

Read the list of JSON5 features used to decide whether the file can simply become strict JSON or must stay JSON5.

Keep the original JSON5 file for people to edit and generate the JSON from it, so comments are not lost.

JSON5 Validator: limits and what to check

Very large numbers lose precision once converted, just as with ordinary JSON in JavaScript.

Duplicate keys are allowed and the last one wins, so a repeated key is not reported as an error.

About JSON5 Validator

JSON5 is JSON made friendlier for people: comments, trailing commas, single quotes, unquoted keys, hex numbers and more. Config files for Babel, Chromium and many tools use it, and VS Code settings use a close relative. Check a file and turn it into strict JSON.

FAQs

Is JSON5 the same as JSONC?

JSONC (JSON with comments, used by VS Code) is a subset of JSON5, so it validates here too.

Are comments kept in the JSON?

No. Plain JSON has no comments, so they are dropped.

Which features does it list?

Comments, trailing commas, single quotes, unquoted keys, hex numbers, Infinity and NaN, and unusual number forms.

Related tools