JSON Formatter

Sorting rebuilds the output and removes comments.

Format, validate, view, convert, and minify JSON or JSON5 in your browser. Select the accepted input syntax and desired output syntax separately, choose tabs or 2 to 4 spaces, and optionally sort object keys recursively. Syntax errors are shown in the output editor.

Choose JSON or JSON5 independently for the input and output. JSON5-to-JSON5 formatting preserves comments, while conversion, key sorting, and minification serialize the parsed data into the selected output syntax.

  • Unquoted field names are allowed (e.g., {name: "Alice"} instead of {"name": "Alice"});
  • Single quotes can be used for strings (e.g., {'name': 'Bob'});
  • Trailing commas are permitted (e.g., {"a": 1, "b": 2,});

Use JSON output for APIs and systems that require standard JSON. Use JSON5 output for developer-maintained configuration where comments, NaN, Infinity, and other JSON5 values need to remain valid.