Skip to content
Devtoolry

JSON Formatter

Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.

About the JSON Formatter

API responses and config files often arrive as one long line of JSON. The JSON Formatter turns it into readable, consistently indented JSON and tells you exactly where the syntax breaks when it is invalid.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the JSON Formatter

  1. Paste JSON into the input panel, open a .json file, or load the sample.
  2. Choose 2 spaces, 4 spaces or tabs for indentation, and switch on key sorting if you want a stable order.
  3. Fix any error using the reported line and column, then copy or download the formatted result.

Frequently asked questions

Does sorting keys change my data?

No. Only the order of object keys changes; values and array order stay exactly as they were. Sorted keys make two documents easier to compare.

Why is my JSON invalid?

The most common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, none of which are allowed in standard JSON. The error message points to the first problem.