JSON Formatter
Beautify and structure your JSON data with custom indentation
Format JSON for humans and for version control
Formatting JSON is about consistency: the same indentation every time, one property per line, arrays and objects clearly nested. That is what makes a config file pleasant to review in a pull request or an API sample easy to scan in documentation. Paste your data here, choose the indentation you prefer and the formatter returns tidy text that can go straight back into your project.
How to format
- Put your JSON in the Input JSON field with typing, Paste, or Load Sample JSON, which creates a user profile with a timestamp. The Bytes figure in the header tracks input size.
- Under Indentation Level, select 2 Spaces, 4 Spaces (the default) or Tabs.
- Press Format & Beautify JSON.
- In the Formatted Result panel, choose Copy JSON or Download .json, which saves formatted-json.json.
What you get
- Syntax colouring on screen: keys, strings, numbers, booleans and null each have their own colour. The copied and downloaded text has no colour codes.
- Built-in validation: if the input cannot be parsed, an error pop-up appears with the message, so a successful format also means the JSON was valid.
- Normalised output: spacing, line breaks and spacing after colons are rewritten uniformly.
Typical uses
- Standardising a settings file to 2-space indentation before committing it to a repository whose style guide requires it.
- Pasting an API sample into a README or a support answer in readable form.
- Finding a missing bracket, since a failed format points to a syntax problem.
- Preparing a test fixture with a consistent layout for snapshot tests.
Details and edge cases
Formatting works by parsing the JSON and printing it again, so anything not in the JSON specification is refused: comments, trailing commas, single-quoted strings and unquoted property names all trigger an error. If your file is JSON with comments, such as some editor settings files, remove the comments first. Because the data is rebuilt, a repeated key appears only once with its last value, and property names that look like whole numbers may move to the top of an object, since JavaScript orders those first. Very long numbers can lose precision. The tool cannot repair broken JSON automatically; it only reports the first problem the parser meets. Everything is processed by JavaScript in the browser tab, so the practical size limit depends on your device.
Related Articles
Related Tools