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?

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

Use it from code

From 3 credits per call

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.

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.