JSON & Data Tools

JSON Formatter

Format valid JSON with 2 or 4 spaces and pinpoint common syntax errors.

Press Ctrl / ⌘ + Enter to run
Read-only result

Format valid JSON with 2 or 4 spaces and pinpoint common syntax errors.

What this tool does

JSON Formatter checks that your JSON is valid, then formats it with consistent indentation. Spaces inside strings and your original input are preserved so you can compare the result.

  • Supports 2-space and 4-space indentation.
  • Syntax errors will display the line number, column number, and reason returned by the browser whenever possible.
  • The formatted results can be copied or downloaded as a .json file.

How to use it

  1. Paste the JSON that needs to be sorted.
  2. Choose 2-space or 4-space indentation.
  3. Click "Format" to check the results or error messages.
  4. Copy the results, or download formatted.json.

Common uses

  • Check the hierarchy of API responses and configuration files.
  • Organize single lines of JSON into a format that's easy for code review.
  • Missing commas, quotes, or brackets were discovered before committing the configuration.

JSON Formatter Features

Reformat valid JSON into 2 or 4 spaces and point out common syntax errors. Review the result, then copy it for use.

FAQ

Will JSON Formatter modify field values?

No. Formatting adjusts indentation and line breaks between JSON values. Spaces inside string values are preserved.

Why do comments report errors?

Standard JSON does not support // or /* */ comments, nor does it allow trailing commas. This tool validates according to standard JSON syntax.

Is the original content still there when formatting fails?

Yes. The original input is preserved. Errors only clear the previous output and show the reason; the JSON in the input field is not replaced.

Back to Developer Tools