json_format
Validate and pretty-print JSON strings with configurable indent width (2 or 4 spaces). Detects parse errors in raw or minified JSON and returns formatted output or error details.
Instructions
Validate and pretty-print a JSON string at a configurable indent width (2 or 4 spaces). Use to detect parse errors in raw JSON or to normalize minified JSON for readability; for schema validation or data transformation, apply your own logic. Runs JSON.parse + JSON.stringify locally with no network calls. On success, returns the formatted JSON string. On parse failure, returns an error message describing the position and nature of the syntax error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Raw JSON text to validate and format. May be minified or already pretty-printed. | |
| indent | No | Indentation width in spaces. Accepts 2 or 4; defaults to 2 if omitted. |