format_json
Read-onlyIdempotent
Validate and pretty-print a string that is ALREADY valid JSON. Strict by design — it is a validity gate: valid JSON comes back formatted, anything else is rejected with the exact parse error. It never repairs, completes, or guesses. NOT for: plain text or prose (will fail), JSON embedded in markdown/prose (extract_json_from_text pulls it out), JS objects (JSON.stringify them first), YAML (yaml_to_json reads it).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | A raw JSON string, e.g. '{"key":"value"}'. Must already parse as JSON — plain text or truncated JSON is rejected, not repaired. | |
| indent | No | Indent size (default: 2) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | No | ||
| formatted | No |