JSON formatter

Pretty-print JSON or minify it to one line. If there's a mistake, it shows you where.

JSON to format

0 characters · 0 lines

Style

0 characters · 0 lines

Everything runs on this device. What you enter is never sent anywhere.

Numbers and strings are kept exactly as written. Big numbers and long decimals are never rounded.

Found it useful? We'd love a share

Something not working, or an idea to make it better?

How to use

  1. 1. Enter JSON

    Tap “Paste” to put in the JSON you copied. You can also long-press the box to paste, or open a .json file with “Open file”. The formatted result appears below right away.

  2. 2. Choose a style

    Under “Style” below the input box, pick an indent width (“2 spaces”, “4 spaces” or “Tab”), or tap “Minify”. Turn on “Sort keys by name” to put keys in name order. The result below changes instantly.

  3. 3. Fix mistakes

    If the JSON has a mistake, the line and column and how to fix it appear instead of the result. Tap “Go to the error” to select that spot in the box above, then delete or rewrite it. Once it's fixed, the formatted result appears right away.

  4. 4. Copy or save

    Tap “Copy” below the result to copy the formatted JSON. Tap “Download JSON” to save it as a .json file.

Great for

  • Reading an API response

    Paste a one-line API response or log, and it's indented so you can check what's inside at a glance.

    Web developers and testers

  • Finding a broken config file

    When package.json or a config file won't load, it shows where the extra “,” or missing bracket is, by line and column.

    Developers and server admins

  • Making JSON smaller to send or paste

    “Minify” strips spaces and line breaks so it's easy to paste into a chat or a request.

    Anyone testing APIs

  • Comparing two JSON files

    Line up the keys with “Sort keys by name” before you diff them, and the differences are much easier to spot.

    People who work with data

Good to know

  • JSON5 and JSONC, which allow comments and trailing commas, are reported as mistakes. Remove those and it formats normally.
  • JSON Lines (.jsonl), with one JSON per line, is read as a single JSON, so it stops at the second line.
  • JSON files of tens of megabytes may take a while, and the box may feel slow on some devices.

About formatting JSON

JSON writes data as pairs of keys and values, and it's used everywhere in APIs and config files. The same data can be easy or hard to read depending on its indentation and line breaks. Formatting only rearranges the spaces and line breaks outside the values, without changing the meaning.

This tool keeps numbers and strings exactly as written. The usual approach (such as JavaScript's JSON.parse) rounds big numbers like 12345678901234567890 and turns 0.10 into 0.1, but here nothing changes. Non-English text and emoji stay readable instead of being turned into codes like \u3042.

Formatting styles compared
What it looks likeBest for
2 spacesIndents by two spacesThe common style for the web and JavaScript
4 spacesIndents by four spacesTelling deep nesting apart more easily
TabIndents by one tabSetting the indent width you like in your editor
MinifyRemoves all spaces and line breaksMaking data smaller to send or store

FAQ

Answers to common questions before you start.

Is my JSON sent anywhere?

No. Formatting and checking happen entirely in your device's browser, and nothing you enter is sent to a server.

How do I find the mistake?

Instead of the result, you'll see the line and column and what's wrong. The spot is also marked in orange in the input box. Click “Go to the error” to select it.

What are the most common mistakes?

The most common is a “,” after the last item. Others include strings or keys in single quotes, keys without double quotes, writing True or undefined, and comments. Each one is shown with how to fix it.

Are big numbers rounded?

No. Numbers are kept exactly as written, so large IDs like 12345678901234567890 and trailing zeros like 0.10 stay the same.

Will non-English text turn into \u codes?

No. Non-English text and emoji stay as they are. Anything already written like \u3042 is kept exactly as written. Turn on “Turn \u codes into characters” to show it as readable text instead.

What does “Sort keys by name” do?

It sorts the keys in each object by name (by character code), including nested objects. The order inside arrays is never changed, because that would change the meaning.

Does “Minify” change my data?

No. It only removes spaces and line breaks outside the values. Spaces inside strings stay as they are.

Can it handle large JSON?

Yes, JSON of several megabytes works. Large input is processed separately once you stop typing, so the page doesn't freeze. Files up to 20 MB can be opened.

Does it support JSON5 or JSON with comments?

It reads standard JSON, so comments and trailing commas are shown as mistakes. Press “Fix and format” to fix comments, trailing commas, single-quoted strings, unquoted keys, True / None and more in one go.

Can it format JSON full of \" from a log?

Yes. Paste JSON that has been turned into a string, like "{\"name\":1}", and it takes the JSON out and formats it. It also works without the outer quotes, like {\"name\":1}.

Is it free?

Yes, it's free. No sign-up and no ads.