JSON Formatter
A tool that formats JSON files in /input and writes prettified versions to /output.
Usage
bash
# Basic usage - format JSON files with default 2-space indent enact run ./examples/tools/json-formatter --input ./data --output ./formatted # Custom indentation enact run ./examples/tools/json-formatter --input ./data --output ./formatted --input indent=4 # Sort keys alphabetically enact run ./examples/tools/json-formatter --input ./data --output ./formatted --input sort_keys=true # In-place formatting with --apply enact run ./examples/tools/json-formatter --input ./src --output ./src --apply
Container Layout
- •
/workspace- Tool source code (format.py) - •
/input- Your JSON files to format - •
/output- Formatted JSON files
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
indent | integer | 2 | Number of spaces for indentation |
sort_keys | boolean | false | Sort object keys alphabetically |