format_json
Format, minify, validate, or analyze JSON documents. Cleans up syntax, sorts keys, and provides structure statistics.
Instructions
JSON Formatter, Minifier and Validator. Pretty-print, minify, validate, or analyze a JSON document, with optional indent width and alphabetical key sorting. Use format_json for plain text-in/text-out cleanup and syntax checking; use format_json_visualizer to browse JSON as an interactive tree, webdev_code_formatter for HTML/CSS/JS, or webdev_json_to_csv to convert JSON into CSV rows. Runs locally on the text you provide: read-only, non-destructive, parses nothing external, and is rate-limited (60 requests/minute for anonymous callers). Returns the processed output string, a validity flag, any parse error, structure analysis, and size and line statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| json | No | The JSON document to process. Alias input is also accepted. Blank input returns isValid false with empty output. | |
| input | No | Alias for json; used only when json is absent. | |
| operation | No | Action to perform. format pretty-prints, minify strips whitespace, validate only checks syntax (empty output), analyze returns structure statistics. | format |
| indent | No | Indentation for format: a space count as a string (for example 2 or 4), or the word tab. Ignored by minify, validate, and analyze. | 2 |
| sortKeys | No | When true, sort object keys alphabetically (recursively) before formatting. Applies to format only. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| isValid | No | Whether the input parsed as valid JSON. | |
| error | No | Parse error message when isValid is false, otherwise null. | |
| output | No | Processed result: pretty JSON, minified JSON, an analysis report, or empty for validate and blank input. | |
| validation | No | Validity plus size metrics for the submitted text. | |
| analysis | No | Structure statistics computed from the parsed JSON. | |
| jsonPaths | No | Per-node path and type entries describing the document structure. |