What is JSONC Formatter?
A JSONC formatter beautifies JSON with Comments (JSONC) — the format used by VS Code settings.json, tsconfig.json, and many configuration files that allow // line comments and /* block comments */ alongside standard JSON syntax.
Standard JSON (RFC 8259) rejects comments and trailing commas, which is why config files from editors like VS Code fail in strict JSON validators. JSONC extends JSON with comment support and optional trailing commas, making it the de facto format for developer tooling configuration.
Our JSONC formatter parses your input with a JSONC-aware parser (the same family used by VS Code), then outputs clean, indented JSON without comments. You can also format JSONC while preserving readability during editing — ideal for reviewing Kubernetes Helm values, ESLint configs, or IDE workspace files.
Processing runs entirely in your browser. Internal configuration files, API schemas with inline documentation comments, and proprietary tsconfig files never leave your machine. No upload, no account, no limits.
If you need strict RFC 8259 JSON without comments, use the standard JSON Formatter. For validation only, try the JSON Validator.
When should you use JSONC Formatter?
Format VS Code settings.json, tsconfig.json, or launch.json files that contain // comments explaining each option.
Clean up Helm values.yaml alternatives stored as JSONC, or configuration exported from tools that embed comments.
Remove comments and trailing commas to produce strict JSON for APIs that reject JSONC syntax.
Review commented config files in pull requests with consistent indentation before merging infrastructure changes.
How to Use JSONC Formatter
- Paste JSONC (JSON with comments) into the editor.
- Choose indentation (2, 4 spaces or tab).
- Click Format to beautify, or Minify to compress.
- Copy or download the output JSON.
Features
- Parse JSONC with // and /* */ comments supported
- Allow trailing commas in objects and arrays
- Beautify with 2, 3, 4 spaces or tab indentation
- Minify JSONC to compact single-line JSON output
- Syntax highlighting in the editor
- Copy or download formatted output
- 100% browser-based — configs stay private
- Clear error messages with line and column numbers
Example
The input uses JSONC syntax with line comments and a trailing comma after the last property. The formatter parses the structure, strips comments, and outputs valid indented JSON suitable for strict parsers and production APIs.
JSONC with comments
{
// Server configuration
"host": "localhost",
"port": 3000, // default port
}Formatted JSON
{
"host": "localhost",
"port": 3000
}Common Errors
JSON5-only syntax
Unquoted keys, single-quoted strings, and hexadecimal numbers are JSON5 features not supported in JSONC.
Fix: Use double-quoted keys and strings. Convert JSON5-specific syntax before formatting.
Unclosed block comments
A /* without matching */ causes a parse error at the end of the file.
Fix: Close all block comments with */. Use line comments // for single-line notes instead.
Comments inside strings
// inside a string value is literal text, not a comment — but accidental quote errors can confuse parsers.
Fix: Escape inner double quotes with backslash. Validate string boundaries before adding comments outside strings.
Best Practices
- Use JSONC for human-edited config files; export strict JSON for runtime APIs and databases.
- Prefer // line comments over block comments for single-line explanations in config files.
- Run the JSON Validator on output when deploying to systems that require RFC 8259 compliance.
- Keep comments concise and up to date — outdated comments mislead reviewers more than no comments at all.
Related Tools
Format JSON online for free. Beautify, minify, and validate JSON instantly in your browser — private, fast, and no sign-up required.
Validate JSON syntax online with precise line and column error messages. Free, fast, and private.
Format and beautify YAML with consistent indentation. Free online YAML formatter.