A simple JSON formatting, validation, and conversion tool.
python3 skills/json-formatter/scripts/json_formatter.py <action> [options]
| Action | Description |
|---|---|
| -------- | ------------- |
format | Format JSON with indentation |
compress | Minify JSON (remove whitespace) |
validate | Validate JSON syntax |
to-yaml | Convert JSON to YAML |
from-yaml | Convert YAML to JSON |
| Option | Type | Default | Description |
|---|---|---|---|
| -------- | ------ | --------- | ------------- |
--input | string | - | Input string or file path |
--indent | int | 2 | Indentation spaces (for format) |
--file | bool | false | Treat input as file path |
# Format JSON
python3 skills/json-formatter/scripts/json_formatter.py format --input '{"name":"test","value":123}'
# Compress JSON
python3 skills/json-formatter/scripts/json_formatter.py compress --input '{"name": "test", "value": 123}'
# Validate JSON
python3 skills/json-formatter/scripts/json_formatter.py validate --input '{"name":"test"}'
# Convert to YAML
python3 skills/json-formatter/scripts/json_formatter.py to-yaml --input '{"name":"test","items":[1,2,3]}'
# From YAML to JSON
python3 skills/json-formatter/scripts/json_formatter.py from-yaml --input 'name: test'
In development.
共 1 个版本