Format a JSON document
format_jsonFormat (pretty-print or minify) a JSON document, optionally sorting object keys. Number literals are preserved exactly (64-bit IDs safe); parse errors report the exact line and column.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"json": "<json>"
},
"name": "format_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| json | Yes | The JSON text to format. | |
| indent | No | Indentation: '2' or '4' spaces, 'tab', or 'minify'. Defaults to '2'. | |
| sort_keys | No | Sort object keys alphabetically. Defaults to false. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | Yes | "line L, col C: message" on a parse error, or null. | |
| formatted_json | No | The formatted document. Absent when the input was refused. |