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
- Paste JSON into the input panel, open a .json file, or load the sample.
- Choose 2 spaces, 4 spaces or tabs for indentation, and switch on key sorting if you want a stable order.
- 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.
Related tools
HTML Formatter
Beautify messy or minified HTML into clean, indented markup using Prettier, right in your browser.
CSS Formatter
Format CSS, SCSS and Less stylesheets into readable, consistently indented code.
JavaScript Formatter
Beautify JavaScript and JSX with Prettier. Choose indentation, quotes and semicolons.
TypeScript Formatter
Format TypeScript and TSX code with Prettier, including types, generics and decorators.
PHP Formatter
Beautify PHP code following PSR-style formatting with the Prettier PHP plugin.
SQL Formatter
Format SQL queries for MySQL, PostgreSQL, SQLite, SQL Server and more with keyword casing options.