JSON5 Formatter

Format JSON5 to valid JSON
online, free & instant

Paste JSON with comments, trailing commas, or unquoted keys and get clean, standards-compliant JSON output. The repair engine handles all JSON5 extensions automatically.

Open JSON5 Formatter

JSON5 to valid JSON in three steps

Paste JSON5 or relaxed JSON Drop JSON with comments, trailing commas, unquoted keys, or single quotes — the repair engine accepts it all.
Comments stripped automatically Both // line comments and /* block comments */ are removed, producing parser-safe JSON.
Keys quoted, commas fixed Unquoted keys get double quotes, single quotes become double quotes, and trailing commas are removed.
Python literals converted True, False, None from Python are converted to true, false, null — ideal for pasted Python dicts.

No account. No upload. No nonsense.

🔒

No Server

Your JSON never leaves your device. There is no backend to send it to.

Zero Dependencies

Single self-contained HTML file. No frameworks, no CDN calls, nothing to break.

📡

Works Offline

Load once and use forever — even on a plane or without internet access.

Related JSON tools

JSON Repair Fix broken JSON with trailing commas, missing quotes, and other common issues.
JSON Validator Check if your JSON is valid and get clear error messages with line numbers.
JSON Formatter Pretty-print JSON with syntax highlighting and a collapsible tree view.
JSON Beautifier Format messy JSON into beautifully indented, readable output.

Common questions answered

What is JSON5 and how is it different from JSON?

JSON5 is an extension of JSON that allows comments (// and /* */), trailing commas, unquoted keys, single-quoted strings, hex numbers, and multi-line strings. It is a superset — every valid JSON is also valid JSON5, but not vice versa.

Can I add comments to JSON files?

Standard JSON does not support comments, but JSON5 does. You can write JSON with // or /* */ comments, then use the Repair tab to strip them and produce valid JSON that any parser can read.

How does the JSON5 formatter handle trailing commas?

The repair engine automatically removes trailing commas from objects and arrays, converting relaxed JSON5 syntax into strict, valid JSON.

Does this tool convert unquoted keys to quoted keys?

Yes. The Repair tab detects unquoted object keys (a JSON5 feature) and wraps them in double quotes to produce standard JSON.

Is the JSON5 conversion done in my browser?

Yes, all processing happens 100% client-side. Your data never leaves your device — no server, no upload, works offline.

What is JSON5?

JSON5 is an extension of JSON that adds features from ECMAScript 5.1 to make it more human-friendly. JSON5 allows single-line and multi-line comments, trailing commas, single-quoted strings, unquoted object keys (when valid identifiers), hexadecimal numbers, and special values like Infinity and NaN. It was designed for configuration files where humans write and maintain JSON by hand.

This tool formats JSON5 input by normalizing it to standard JSON, then applying indentation and syntax highlighting. If you have a JSON5 configuration file (like a babel.config.json5), paste it here to get a clean, readable version. The output is strict JSON — comments and trailing commas are removed since they are not valid in the JSON specification.

Format JSON5 to standard JSON
Input
{
  // user config
  name: 'Alice',
  age: 30,
  active: true,
}
Output
{
  "name": "Alice",
  "age": 30,
  "active": true
}

Get the most out of this tool

Ready to format your JSON5?

Free forever. No signup. Instant results.

Convert JSON5 to JSON now

Understanding JSON5 and its extensions to JSON

JSON5 was created in 2012 by Aseem Mital to address the pain points developers experience when writing JSON by hand. While standard JSON is an excellent machine-generated format, it becomes tedious for humans to author and maintain — particularly the prohibition on comments and trailing commas. JSON5 is a strict superset of JSON: every valid JSON document is valid JSON5, but JSON5 allows several additional syntactic conveniences that standard JSON forbids.

Single-line comments using // and multi-line block comments using /* ... */ are perhaps the most frequently missed feature of standard JSON. Configuration files written in JSON often need to document why a value is set, what a field means, or which environment a setting applies to. JSON5 comments fill this gap, enabling self-documenting configuration files that explain their own settings inline.

Trailing commas after the last item in arrays and objects eliminate a common source of JSON syntax errors. In standard JSON, adding a new item to the end of a list requires adding a comma to the previously final item, which shows up as a confusing diff entry. In JSON5, trailing commas are allowed, so each item can independently have a trailing comma — making list additions produce single-line diffs and making the format more version-control friendly.

Unquoted object keys are another JSON5 convenience. Standard JSON requires all keys to be double-quoted strings, even when they are simple identifiers. JSON5 allows ECMAScript 5 identifier names as unquoted keys: {name: "Alice"} instead of {"name": "Alice"}. Keys that are reserved words or contain special characters still require quoting, but simple alphanumeric keys can be written without quotes.

Single-quoted strings provide an alternative to double-quoted strings, which is familiar to developers coming from JavaScript, Python, or Ruby backgrounds where single and double quotes are interchangeable. JSON5 also supports multi-line string literals — a string can span multiple lines when each line continuation is marked with a backslash, avoiding the need to embed \n escape sequences for readable multi-line content.

Numeric extensions in JSON5 include hexadecimal literals (0xFF), IEEE 754 special values (Infinity, -Infinity, NaN), and an explicit positive sign for numbers (+1.5). Standard JSON cannot represent infinity or NaN, causing JavaScript's JSON.stringify(Infinity) to produce the string "null". JSON5 provides a standards-backed way to represent these values in data files.

The practical adoption of JSON5 has been significant: Babel uses it for babel.config.json5, ESLint accepts it for configuration, and VS Code uses a JSONC variant (JSON with comments) for its settings.json. The json5 npm package provides parsing and serialization for Node.js applications. However, JSON5 is not supported by language standard libraries — Python's json module and Go's encoding/json package only handle standard JSON, requiring explicit JSON5 parser libraries.

When developers use JSON5

Application configuration files JSON5 shines in configuration files that developers maintain by hand. Comments explain environment-specific values, trailing commas simplify adding and removing options, and unquoted keys reduce visual noise — making complex configuration files readable and maintainable.
Converting hand-written JSON5 to standard JSON When a JSON5 configuration file needs to be consumed by a tool that only accepts standard JSON, this formatter strips comments, trailing commas, and other JSON5 extensions to produce valid RFC 8259 JSON that any JSON parser can handle.
JavaScript build tool configurations Babel, Webpack, and ESLint configuration files often use JSON5 or JSONC variants to allow comments that explain complex transform rules and plugin options. Converting these configs to standard JSON is useful when sharing them with systems that only accept standard JSON.
Data files with embedded documentation Test fixture files, seed data, and API mock data benefit from inline comments that explain the purpose of each test case or the reasoning behind specific test values. JSON5 enables documented test data without requiring a separate documentation file.

JSON5 pitfalls and limitations

Additional frequently asked questions

Is JSON5 an official standard?

JSON5 is not an IETF or ISO standard. It is a community-maintained specification published at json5.org. The specification is stable and widely implemented, but it is not recognized by standards bodies the way JSON (RFC 8259) is. For interoperability with external systems, always prefer standard JSON unless you control both the producer and consumer.

Which tools and languages support JSON5 natively?

The json5 npm package supports JSON5 in Node.js. Babel uses JSON5 for its configuration file. VS Code uses a JSONC (JSON with comments) variant for settings. Python, Go, and Java do not include JSON5 parsers in their standard libraries — you must add a third-party library. The json5 specification lists known implementations across languages at json5.org.

What is the difference between JSON5 and JSONC?

JSONC (JSON with Comments) is a subset of JSON5 that only adds comments to standard JSON, without the other JSON5 extensions like trailing commas, unquoted keys, or single-quoted strings. VS Code uses JSONC for its configuration files. JSON5 is a superset that includes JSONC features plus additional extensions. Most JSONC documents are also valid JSON5.

Can JSON5 be used for API request and response bodies?

No — HTTP APIs expect Content-Type: application/json bodies to be standard RFC 8259 JSON. JSON5 is not a recognized MIME type and most HTTP frameworks will reject JSON5 bodies. Use JSON5 only for local configuration files and data files where you control the parser. Convert to standard JSON before sending over HTTP.