JSON5 Validator Online
Validate JSON5 config files: tsconfig.json, .babelrc, .eslintrc: without false “invalid JSON” errors from comments and trailing commas. Get a real syntax verdict, specific error messages, and structure stats.
The false-invalid problem with standard JSON validators
Developer config files are designed to be human-readable. TypeScript's tsconfig.json, Babel's .babelrc, and ESLint's .eslintrc.json routinely contain inline comments explaining why a compiler option is set, what a rule does, or why an exception exists. These comments are completely valid in the tools that read them: but they are explicitly forbidden by the JSON specification.
When you paste one of these files into a standard JSON validator, every // line triggers a SyntaxError. You get back a wall of errors, none of which reflect real structural problems. The JSON5 Validator strips comments correctly and then validates the underlying structure: so only genuine issues (mismatched brackets, unclosed strings, wrong value types) are reported.
What the validator checks
Config files you can validate here
- tsconfig.json: TypeScript compiler options, include/exclude paths, paths aliases
- .babelrc / babel.config.json: Babel plugins, presets, and environment overrides
- .eslintrc.json: ESLint rules, extends, and plugin configurations
- jest.config.json: Jest transform rules, moduleNameMapper, coverage config
- .vscode/settings.json: Workspace editor settings and extension options
- launch.json, tasks.json: VS Code debugger configurations
- Any .jsonc file: JSON with Comments as defined by the VS Code ecosystem
JSON5 vs standard JSON: what the validator accepts
Standard JSON rejects: // comments, /* block comments */, trailing commas, unquoted keys, single-quoted strings. This validator accepts all of these as part of JSON5/JSONC syntax. It only reports errors that represent genuine structural problems: unclosed braces, missing colons, malformed values, or deeply nested invalid content.
How to use
- Paste your JSON5 or JSONC content: or drag-and-drop your config file.
- Click Validate →.
- Read the verdict: Valid (green) or Invalid (error message with location).
- Review stats: line count, key count, nesting depth.
- If valid and you need standard JSON output, use the JSON5 Formatter.
Privacy
All validation runs in your browser. Config files often contain module names, internal path structures, and build tool secrets. Nothing you paste here is transmitted to any server.
Frequently asked questions
Why does my tsconfig.json show errors in a standard JSON validator but works with TypeScript?
TypeScript uses its own JSONC parser that allows comments and trailing commas. Standard JSON validators use JSON.parse, which rejects both. The JSON5 Validator uses the same lenient approach as TypeScript: stripping comments before validating structure: so you get a correct verdict.
What does the nesting depth stat tell me?
Depth is the maximum number of nested object/array levels. Most config files sit at depth 2–4. Depth 8+ often indicates a generated or auto-merged config. High depth makes configs harder to debug and maintain: it is worth reviewing any config with depth above 6.
My config has a URL in a comment: will the // in the URL be treated as a comment start?
No. Comment detection runs on characters outside of string boundaries. A URL like "https://example.com" inside a quoted string is safe: the // inside quotes is not treated as a comment start. The issue only arises with unquoted // characters in the JSON structure itself.
What is the difference between JSON5 validation and JSON Schema validation?
JSON5 validation checks syntax: is the file well-formed? JSON Schema validation checks semantics: do the values match the expected types and constraints? Use this tool first to confirm the file is syntactically correct, then use JSON Schema Validator to verify the content structure.
I want to validate .jsonc files specifically: does this tool handle JSONC?
Yes. JSONC is a subset of JSON5 (it adds only comments and trailing commas). Everything valid in JSONC is also valid in JSON5 and is handled correctly by this validator.
After validating, how do I convert the file to standard JSON?
Use the JSON5 Formatter tool. It strips comments, removes trailing commas, and quotes unquoted keys: producing strict RFC 8259 JSON that JSON.parse and any standard tool accepts.
Related tools