JSON5 Formatter

Format JSON5 — JSON with comments, unquoted keys, single quotes and trailing commas — into clean, consistently indented JSON5. Syntax errors are reported. Runs in your browser.

Suggested tools

JSON5 Validator

Check JSON5 config files and see the exact error position.

JSON5
Open Tool

JSON Formatter

Beautify, minify and validate JSON instantly in your browser.

JSON
Open Tool

XML Formatter

Beautify, minify and validate XML instantly in your browser.

XML
Open Tool

YAML Formatter

Re-indent YAML and check it for syntax errors, with line numbers.

YAML
Open Tool

HTML Formatter

Indent and tidy HTML, or minify it.

HTML
Open Tool

CSS Formatter

Beautify minified CSS into readable rules, or minify it.

CSS
Open Tool

About JSON5 Formatter

JSON5 Formatter reads JSON5 — the friendlier superset of JSON that allows comments, unquoted keys, single-quoted strings, trailing commas, hexadecimal numbers and Infinity/NaN — and writes it back with clean, consistent two-space indentation.

JSON5 is used in config files such as Babel and some build tools. If the input contains a syntax error, the message explains what is wrong and where. Everything runs locally in your browser — the text you paste is never uploaded.

How to use JSON5 Formatter

  1. Paste your JSON5 or upload a file.
  2. Press Beautify.
  3. Copy or download the formatted JSON5.

Key features

  • Accepts comments, unquoted keys and trailing commas
  • Clean two-space output
  • Clear error messages with positions
  • Uses the reference json5 library

Example

The comment is dropped and the layout is re-indented in JSON5 style.

Input
{
  // server settings
  host: 'localhost',
  port: 8080,
  debug: true,
}
Output
{
  host: 'localhost',
  port: 8080,
  debug: true,
}

When to use JSON5 Formatter

  • Tidying JSON5 configuration files with comments and unquoted keys.
  • Checking and normalising config files written by hand.
  • Converting messy JSON5 into a consistent style before committing.

Tips and common problems

  • Comments are removed when formatting — keep the original if they matter.
  • Plain JSON is valid JSON5, so you can format JSON here too.
  • Use JSON5 Validator if you only want to check a file without changing it.

Frequently asked questions

No. The JSON5 is parsed into data and written out again, and comments are not part of the data, so they are removed. Keep your original if the comments matter.