Skip to content

JSON5 Formatter

Embed

Paste this where you want JSON5 Formatter on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/json5-formatter/" width="100%" height="500" frameborder="0" loading="lazy" title="JSON5 Formatter"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/json5-formatter/">JSON5 Formatter</a> by BrowserUtils</p>

Format JSON5 with comments and trailing commas.Runs in this tab.

Next step

About JSON5 Formatter

Free online JSON5 formatter and beautifier. Format JSON5 documents that include comments, trailing commas, and unquoted keys. It runs in your browser. Nothing is sent to a server.

Questions

What is JSON5 and how is it different from JSON?
JSON5 is an extension of JSON that allows comments (single and multi-line), trailing commas, unquoted keys, single-quoted strings, and other conveniences. This formatter handles all these features while producing clean, indented output.
Can I use this to format regular JSON too?
Yes, since JSON is a valid subset of JSON5, you can use this formatter for standard JSON files as well. It will format them with proper indentation while preserving any JSON5 features present.
Does the JSON5 formatter preserve comments?
Yes, both single-line (//) and multi-line (/* */) comments are preserved in the formatted output, which is one of the main advantages of JSON5 over standard JSON.
Where is JSON5 commonly used?
JSON5 is used in configuration files where comments are helpful, such as Babel configs, ESLint configs, and VS Code settings files. It provides the structure of JSON with the readability of a more forgiving syntax.

More in Formatters & Beautifiers

All 26 formatters & beautifiers