---
title: "Format / validate JSON"
method: POST
path: "/v1/tools/json_format"
---

# Format / validate JSON

`POST /v1/tools/json_format`

## Request

- Base URL: `https://mcp.cleanor.app`
- URL: `https://mcp.cleanor.app/v1/tools/json_format`
- Auth: none declared

Validate JSON and pretty-print or minify it, optionally sorting object keys. Returns a precise parse error (with position) if invalid. Use to check and clean JSON instead of eyeballing it.

## Request body

- object
  - `input` string, required: JSON text.
  - `mode` 'pretty' | 'minify': pretty = 2-space indent; minify = single line.
  - `sort_keys` boolean: Sort object keys alphabetically (deep).

## Response `200`

Tool result: `data` (structured) and `text` (human-readable).

- ToolResult
  - `ok` boolean
  - `tool` string
  - `data` object, nullable
  - `text` string
  - `attribution` string

## Other responses

- `400`: Invalid arguments.
- `429`: Rate limited (120 requests per minute per IP).

---

[API](https://skmtc.dev/cleanor/apis/cleanor-api.md) · [All operations](https://skmtc.dev/cleanor/apis/cleanor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cleanor/apis/cleanor-api/revisions/5f7be54e7a84?raw)
