JSON Formatter

Format, beautify and minify JSON online with clean indentation — free JSON formatter.

About

About the JSON Formatter

Pretty-prints messy or minified JSON into readable, indented text, or squashes it back down to a single compact line.

Backend developers use it to make an API response readable before pasting it into a bug report or a Slack thread, while frontend developers use it to check that a payload's shape matches what their code expects. It's one of many free data tools on Toolapt, and like every tool here, it's free to use with no sign-up and no limit on how many times you run it.

Choose what to view about this tool

Guide

Using the JSON Formatter

  1. 1

    Step 1

    Paste your JSON into the JSON input box.

  2. 2

    Step 2

    Pick an indent size — 2 spaces, 4 spaces or a tab — and turn on "Sort keys A to Z" if you want them ordered.

  3. 3

    Step 3

    Click "Format" to pretty-print it, or "Minify" to collapse it to one line.

  4. 4

    Step 4

    Click "Copy" to copy the result, or "Clear" to start over.

  • Pretty-prints JSON with a choice of 2 spaces, 4 spaces or tab indentation
  • Minifies JSON down to the shortest valid single-line form
  • Optional alphabetical key sorting, applied recursively through nested objects
  • Reports the exact line and column of a JSON syntax error, with the text right around it
  • Works entirely in your browser — nothing you paste is sent to a server
  • Free to use, with no sign-up and no limit on how many times you run it
  • Fully responsive, so it works just as well on a phone as on a desktop

Backend developers

Backend developers use the JSON Formatter for pretty-printing an API response before pasting it into a bug report, log, or code review comment.

Frontend developers

Frontend developers use the JSON Formatter for checking that a payload's shape and field names match what their UI code is expecting.

QA engineers

QA engineers use the JSON Formatter for comparing two API responses side by side after sorting both to the same key order.

Students learning APIs

Students learning APIs use the JSON Formatter for turning a wall of minified JSON from a tutorial into something they can actually read and study.

Examples

JSON Formatter examples

4 worked examples

01

Minified JSON, pretty-printed

Paste {"id":1,"name":"Ada","tags":["js","py"]} with indent set to 2 and click Format to get 7 lines, with id, name and tags each on their own line.

02

Sort keys A to Z

Paste {"name":"Ada","id":1} with Sort keys A to Z turned on to get {"id":1,"name":"Ada"} — id now sorts before name.

03

Minify back to one line

Take pretty-printed JSON and click Minify to collapse it back to {"id":1,"name":"Ada","tags":["js","py"]} on a single line, with all whitespace removed.

04

Invalid JSON caught

Paste {"id":1, "name": } and the tool reports it as invalid JSON, showing the exact line and column where parsing failed.

FAQ

Frequently asked questions

Quick answers to common questions about the JSON Formatter.

What does the JSON Formatter do?

It pretty-prints JSON with your choice of indentation, or minifies it down to one compact line, with an option to sort every object's keys alphabetically.

Is the JSON Formatter free to use?

Yes. It's free, with no sign-up, no watermark and no limit on how many times you use it.

Is my JSON safe when I use this tool?

Yes. Everything runs in your own browser using JavaScript's built-in JSON parser — nothing you paste is sent to a server.

What happens if my JSON is invalid?

The tool tells you it's invalid and points to the exact line and column where parsing failed, along with a snippet of the text around that position.

What does "Sort keys A to Z" do?

It reorders every object's keys alphabetically, recursively through the whole document, which makes it much easier to compare two JSON documents that should be similar but were built with keys in a different order.

What's the difference between Format and Minify?

Format pretty-prints the JSON with line breaks and indentation for readability. Minify strips all of that out and returns the shortest valid single-line representation.

Can I use the JSON Formatter on my phone?

Yes. The page is fully responsive and works on mobile, tablet and desktop browsers alike.

Does the JSON Formatter have any limitations?

It relies on the browser's native JSON parser, so it follows the strict JSON spec — it won't accept JavaScript-only syntax like trailing commas, comments or unquoted keys.

Still have a question? Contact us

Report a problem

JSON Formatter

What went wrong?
    or paste a screenshot