← All blog posts

JSON Formatter for beginners — start here

WhiteUI · A plain-English guide to the JSON Formatter

If you have never worked with JSON before, the idea is simple: it is a way of writing down structured information as plain text, so that both people and programs can read it. A name and a value sit together, separated by a colon; several pairs sit inside curly braces; and a list of items sits inside square brackets. The JSON Formatter takes that text and lays it out neatly, or squeezes it down, and this guide starts from zero and ends with a formatted result you can use.

At a glance

4 top-level keys0510name, tools, free, tools_count
The default sample has 4 top-level keys: name, tools, free and tools_count.

What JSON looks like

Look at the sample already in the box: {"name": "WhiteUI", "tools": ["EMI Calculator", "SIP Calculator"], "free": true, "tools_count": 2}. The curly braces say this is one object. Inside it are four pairs: "name" goes with "WhiteUI", "tools" goes with a list of two calculator names, "free" goes with true, and "tools_count" goes with 2. The square brackets say the tools value is a list, and every piece of text is in double quotes, while every number stands on its own. That is the whole shape of JSON.

Your first try: leave everything as it is

Open the tool and look before you touch anything. The sample is already pasted, and the result panel already shows the answer: the big line reads “120 characters”, and the line under it reads “Valid JSON · 4 top-level keys · Mode: Pretty”. The formatted version sits in the box on the right, spread across 9 lines, with each key on its own line and the two tool names indented four spaces. Copy it with the Copy JSON button and paste it into a document to see it in place.

The two modes, in plain words

Pretty is the readable version: it puts each key on its own line and indents the lines, so the sample becomes 9 lines and 120 characters, and you can see the structure at a glance. Compact is the short version: it puts everything on one line with no extra spaces, so the same sample becomes 90 characters, and it fits in places where space is tight. The data is the same in both: the same four keys, the same two tool names, the same number 2. Start with Pretty whenever a person will read the result.

Your second try: paste a smaller example

Clear the box and paste a weather report: {"city": "Mumbai", "temp_c": 31, "rain": false}. It is 47 characters as pasted, and it has three keys: city, temp_c and rain. In Pretty mode it becomes 55 characters across 5 lines, one line per key plus the two braces, and in Compact mode it becomes 42 characters on one line. The temperature, 31, and the rain value, false, are unchanged in both versions. That is the whole skill at this level: paste a block, read the counts, and pick the layout that suits where the result is going.

A third try: break it on purpose

Clear the box and paste {oops}, with no quotes at all. The big line reads “Invalid JSON”, and the line under it shows the error: “Expected property name or ‘}’ in JSON at position 1 (line 1 column 2)”. Position 1 is the second character, the letter o, where the parser expected a quoted key name. That error is the tool telling you exactly where the text stops being JSON. Fix the spot it names, paste again, and the result appears.

The common mistake

Beginners often write keys and text in single quotes, because that is how some programming languages write text. JSON does not accept single quotes: {"name": "x"} written with ’ fails at position 1, the very first character. Use double quotes for every key and every piece of text, and the same input formats cleanly. The other common slip is a comma after the last item, such as {"a": 1,}, which fails at position 8. Remove that last comma and the object is valid.

Frequently asked questions

What is JSON?

A way of writing structured data as plain text: names and values inside curly braces, lists inside square brackets, and every piece of text in double quotes.

What does the JSON Formatter show when it opens?

The built-in sample formatted in Pretty mode: 120 characters across 9 lines, with 4 top-level keys.

Which mode should a beginner start with?

Pretty. It puts each key on its own line with 2 spaces of indent, so the structure is easy to read.

Why does {oops} fail?

Because the keys are not in double quotes. The error names position 1, the second character, where a quoted key name was expected.

More guides on the JSON Formatter

Try it yourself

Try the JSON Formatter — free, in your browser.

Open the JSON Formatter