Skip to content
Devlar

Runs in your browser. Your input stays on your device.

JSON Formatter

Paste JSON to turn it into clean, consistently indented output. If the JSON is invalid, the formatter explains the problem and shows the exact line and column.

Opens a file from your device. The file is read in your browser and is not uploaded.

0 characters · 0 B

0 characters · 0 B

Privacy: This tool runs in your browser. Your input is processed on your device and is never uploaded to a server.

How to use

  1. Paste or type your JSON into the JSON input box, or select Load example to try it with sample data.
  2. Choose an indentation: 2 spaces, 4 spaces, or tabs.
  3. Select Format, or press Ctrl+Enter (Cmd+Enter on a Mac) anywhere in the tool, not only in the input box. Press ? to see all keyboard shortcuts.
  4. If the JSON is invalid, read the error message, then select Go to error to jump to the exact line and column in your input.
  5. Select Copy output to copy the result, or Download .json to save it as a file.

Example

Minified JSON formatted with 2-space indentation.

Input
JSON
{"id":1024,"name":"Ada Lovelace","email":"ada@example.com","roles":["admin","editor"],"active":true,"profile":{"timezone":"Europe/London","lastLogin":null},"stats":{"posts":42,"rating":4.8}}
Output
JSON
{
  "id": 1024,
  "name": "Ada Lovelace",
  "email": "ada@example.com",
  "roles": [
    "admin",
    "editor"
  ],
  "active": true,
  "profile": {
    "timezone": "Europe/London",
    "lastLogin": null
  },
  "stats": {
    "posts": 42,
    "rating": 4.8
  }
}

Frequently asked questions

Is my JSON uploaded anywhere?

No. Formatting runs in JavaScript inside your browser, and the tool never sends your input anywhere. Your data stays on your device.

Does it keep large numbers and duplicate keys exactly?

Yes. Many online formatters convert your JSON into JavaScript values and print them again. That quietly rounds integers above 9,007,199,254,740,991 (so an ID like 9007199254740993 comes back as 9007199254740992) and keeps only the last copy of a repeated key. This formatter rewrites only the whitespace between tokens, so numbers, duplicate keys, key order, and escape sequences such as \u00e9 come out exactly as you wrote them. The one other change: a byte order mark at the very start of the input is removed.

Why does it say my JSON is invalid?

JSON is stricter than JavaScript. The usual culprits are a trailing comma after the last item, single quotes, property names without quotes, comments, and a missing closing bracket or brace. The error gives the line and column of the first problem. For a closer look with the surrounding code highlighted and a suggested fix, use the JSON Validator.

How large a file can I format?

Files of several megabytes work. A 5 MB file formatted and displayed in under a second during testing on a desktop computer. When the result is larger than 1 MB, the output box shows only the first 5,000 lines so the page stays responsive; Copy output and Download always contain the complete formatted result. For big files, use Open file instead of pasting: the file is read directly without being drawn in the editor, and a 7 MB file opened and formatted in under half a second in testing.

Should I use 2 spaces, 4 spaces, or tabs?

It is a matter of style and does not change the data. Two spaces is the most common choice for JSON. If your project already uses a style guide or an editor configuration, match that.

JSON Validator

Check JSON for errors with line, column, and code context, and catch duplicate keys and unsafe large numbers.

JSON Minifier

Shrink JSON by removing whitespace without changing any values, and see how much smaller it gets.

CSV to JSON Converter

Convert CSV or TSV to JSON with delimiter detection, header handling, and optional, lossless type detection.

Keyboard shortcuts

Run the tool, from anywhere in it
Ctrl+Enter
Show this list (outside text fields)
?
Close this list
Esc