JSON Formatter

Paste JSON and it is indented as you type. Every number and every key stays exactly as you wrote it, even IDs too long for JavaScript. A mistake shows its line, column and cause.

How it works

The JSON is read by a parser written for these tools, not by the browser's JSON.parse. It keeps each number as the text you wrote, so 12345678901234567890 is not rounded, and it keeps keys in their written order.

The tree is then written back with one level of indent per nesting level: 2 spaces, 4 spaces or a tab, as you choose. Empty objects and arrays stay on one line as {} and [].

If the JSON cannot be read, nothing is written and the first mistake is shown with its line, column and a plain explanation. Everything runs on this page. Input is capped at 2 MB so the page stays responsive.

How to use it

  1. 1 Pick 2 spaces, 4 spaces or Tab.
  2. 2 Paste your JSON into the first box. A response body, a config file or a log line all work.
  3. 3 Read the formatted JSON in the second box, or the error under the first box.
  4. 4 Press Copy result, or download the result as a .json file.

Good to know

  • To go the other way and put JSON on one line, use the JSON Minifier.
  • If you only want to know whether the JSON is valid, and whether any numbers or keys might cause trouble, use the JSON Validator.
  • Escapes inside strings are written in their plain form: \u00e9 becomes é and \/ becomes /. The text means exactly the same to every JSON reader.
  • To make two files easy to compare, sort their keys first with JSON Sort Keys, then format both the same way.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Formatting JSON without changing a single value

A JSON formatter has one job: change the spaces and line breaks so a person can read the data, and change nothing else. That sounds easy, and most online formatters still get it wrong in two quiet ways. Both come from the same shortcut. They read the text with the browser's JSON.parse, then write it back with JSON.stringify. The round trip passes through JavaScript values, and JavaScript values cannot hold everything JSON can say.

The first problem is numbers. JSON puts no limit on how long a number can be, but a JavaScript number is a 64-bit float with about 16 significant digits. Twitter, Discord and many databases use 64-bit integer IDs, and a value such as 1234567890123456789 does not fit. JSON.parse rounds it to the nearest value it can hold, and the formatted output shows a different ID with no warning. Decimals suffer too: 1.10 comes back as 1.1, and 1e2 comes back as 100. They are equal as numbers, but the text changed, and a diff or a signature check will notice.

The second problem is key order. A JavaScript object lists keys that look like array indexes first, in numeric order, and the rest after them. So {"b": 1, "10": 2, "a": 3} becomes {"10": 2, "b": 1, "a": 3}. The data is the same, but the file no longer matches the one you pasted, and a person scanning for a key finds it in the wrong place.

This formatter avoids both by never building JavaScript objects. Its parser keeps each number as the exact text it was written with, and keeps each object as a list of key and value pairs in their original order. Writing the result back is then just a matter of adding indentation between the pieces. The only thing that changes inside a value is how a string is escaped: an escape such as \u00e9 is written as the letter é, because both mean the same character to every JSON reader.

The parser also explains mistakes better than the browser does. JSON.parse gives a terse message that differs between Chrome, Firefox and Safari. Here a trailing comma, a single-quoted string, a comment, a Python True or None, or a missing comma each gets its own plain sentence, with the line and column where it happened. Fix that one, and the formatted JSON appears as soon as the input is valid. It all runs on your device, so internal API responses and config files stay with you.

Frequently asked questions

Why do other formatters change my long numbers?

Most of them call JSON.parse and then JSON.stringify. JavaScript numbers hold about 16 significant digits, so 12345678901234567890 is read as 12345678901234567000 and written back that way. This formatter never turns a number into a JavaScript number. It copies the digits you wrote, so 1.10 stays 1.10 and a 20-digit ID stays 20 digits.

Does it change the order of my keys?

No. A JavaScript object moves keys that look like whole numbers, such as "10" or "2", ahead of the others. This tool keeps its own list of keys in the order they appear, so the output matches the input key for key.

What happens to a key that appears twice?

Both copies are kept, in place. The formatter does not decide which one wins, because that is a choice for the program that reads the file. The JSON Validator lists keys written twice if you want to find them.

Is my JSON uploaded anywhere?

No. Parsing and formatting both run in this page. You can paste API responses with tokens or customer data in them; nothing is sent to YappyKit or anyone else.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.