← All blog posts

JSON Formatter vs doing it by hand — which is faster?

WhiteUI · A plain-English guide to the JSON Formatter

For a tiny object, formatting by hand feels fast enough: a few line breaks and some spaces, done in seconds. For a nested block with lists inside objects, the JSON Formatter is faster and far less likely to slip a space or a comma. The comparison below shows why.

At a glance

One click vs nine linesTool: 1 clickBy hand: 9 lines120 characters, 9 lines, 1 click
The tool formats 120 characters across 9 lines in one click, against nine lines typed out by hand.

By hand: the easy cases

If the object is small, hand formatting is quick. Take {"a": 1}, which is 8 characters as pasted. Its Pretty version is 12 characters across 3 lines: the opening brace, the key line two spaces in, and the closing brace. Typing those three lines takes seconds, and there is nothing to count. The same is true for a flat object with two or three keys, such as the weather example, {"city": "Mumbai", "temp_c": 31, "rain": false}, which formats to 5 lines and 55 characters. When the structure is flat and short, the tool saves you only a few seconds.

By hand: the slow cases

Try the order example by hand. The input is {"order": 4517, "items": [{"name": "Notebook", "price": 120}, {"name": "Pen", "price": 45}], "paid": true}, 106 characters, and the Pretty version is 162 characters across 14 lines. Each of the two items needs three lines, the prices sit six spaces in, and the brackets have to close in the right order: the item object, then the list, then the whole object. Counting two spaces per level across 14 lines is slow, and one slip, such as indenting a price by four spaces instead of six, makes the nesting look wrong. With the tool you paste once and read 14 correct lines in about 5 seconds.

A second comparison: three examples at once

Now try formatting three blocks by hand: the sample at 9 lines, the order at 14 lines, and the user record at 16 lines. That is 39 lines to type, with indents of two, four and six spaces to keep straight, and a comma after every line except the last one in each group. Miss one comma and the result is not valid JSON at all. With the tool you paste each block in turn and read 39 correct lines in under a minute.

Compacting by hand is slower still

Going the other way is worse. Turning the sample’s Pretty output back into Compact by hand means deleting 30 characters of spaces and line breaks, one by one, from 120 characters down to 90, without deleting a comma or a quote by accident. One wrong deletion and the text is invalid. The tool does it in one click, and the result is exactly 90 characters, with every comma and quote still in place. The bigger the block, the worse the hand version gets: the user record drops from 172 characters to 93, which is 79 characters to delete by hand.

When the tool wins outright

Use the tool when the JSON has any nesting, when it has more than a few keys, or when the result has to be exact, such as text you will paste into an API or a settings file. Use your hands only when you are reading a tiny flat object and nobody will check the layout. The dividing line is simple: if the formatting has to be right, generate it; if only the values matter and the layout is throwaway, typing it out is fine.

The common mistake

People format a block by hand, change a value by accident while retyping, and then spend an hour debugging data that was never right to begin with. A price of 120 retyped as 12, or a tools_count of 2 retyped as 20, still looks like valid JSON, so nothing flags the error. The tool never touches values: it only adds or removes whitespace, so the prices stay 120 and 45 and the count stays 2. If a value looks wrong after formatting, the input was wrong, and the tool is showing you what you actually pasted.

Frequently asked questions

Is it faster to format JSON with the tool or by hand?

With the tool for anything nested or longer than a few keys. The sample takes one click with the tool, against 9 lines typed out by hand.

How many lines would the order example take by hand?

14 lines and 162 characters, with indents of 2, 4 and 6 spaces to count, against one paste with the tool.

How much whitespace does Compact remove from the sample?

30 characters: from 120 characters in Pretty down to 90 in Compact, deleted one by one if done by hand.

When is formatting JSON by hand fine?

When the object is tiny and flat, such as {"a": 1}, and nobody will check the layout. If the result has to be exact, generate it.

More guides on the JSON Formatter

Try it yourself

Try the JSON Formatter — free, in your browser.

Open the JSON Formatter