JSON format / minify / validate
json_formatFormat, minify, or validate JSON, optionally sort keys, and get clear line-and-column errors for invalid input; also report size, key count, depth, and value count.
Instructions
Validate, pretty-print (2 or 4 spaces, tab) or minify JSON, optionally sorting object keys (deeply). Invalid JSON gives a clear error with line and column and the lines around it. Also returns size, key count, depth and value count. Give "text" or a file "path"; "output" writes the result to a file. Uses the standard JSON parser (no comments or trailing commas). Web version: https://s3eidat.github.io/json-studio/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "format" pretty-prints, "minify" removes all whitespace, "validate" only checks (never throws on bad JSON). | format |
| path | No | Or: a path to a JSON file (UTF-8; use this for big inputs). | |
| text | No | The JSON as inline text. | |
| indent | No | Indentation: 2, 4, "tab" (or any number of spaces 0-8). | 2 |
| output | No | Optional: also write the result to this file path (or folder ending in "/"). The result text is then left out of the reply. Results over 1,000,000 characters are always written to a file. | |
| sortKeys | No | Sort object keys alphabetically at every level. |