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
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
.jsonfile.
How to use it
- Paste JSON into the input box — formatting happens instantly.
- Choose your indentation style, or Minified to compress.
- 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.
Use it from code
From 3 credits per callREST 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_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.