Skip to main content

JSON Formatter

Format, validate and minify JSON instantly. Pretty-print with 2 or 4 spaces or tabs, optionally sort keys alphabetically, and get a clear error message when the JSON is invalid.

Input

Output

Formatted JSON
 
Was this helpful?

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/json-formatter \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "json": "{\"name\":\"iotools\",\"tools\":683,\"free\":true,\"tags\"…",
    "indent": "2",
    "sortKeys": ""
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `json-formatter` tool (JSON Formatter) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/json-formatter/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="JSON Formatter — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per API/MCP callFrom 5 credits
Need more credits?View pricing

Also available with

Guides

What does this JSON formatter do?

It takes raw, cramped or messy JSON and turns it into cleanly indented, syntax-highlighted output — or the opposite: a minified single line ready for production. Every run also validates the input; if the JSON is broken you get the parser's exact error message instead of silent failure.

Features

  • Pretty-print with 2 spaces, 4 spaces or tabs — or minify.
  • Sort keys alphabetically (recursively) for stable diffs and easier comparison.
  • Live validation with precise error messages as you type.
  • Copy the result or download it as a .json file.

How to use it

  1. Paste JSON into the input box — formatting happens instantly.
  2. Choose your indentation style, or Minified to compress.
  3. Tick Sort keys if you want a canonical, diff-friendly ordering.

Privacy

Parsing and formatting run entirely in your browser. Your data never leaves your device — safe for API responses and configs you'd rather not paste into a random website's server.

jsonformattervalidatordeveloper

Part of a workflow

All collections

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.