ef5f6c839753b7a5a960e42e258188adca8f2afc
ConfigConvert CLI
A powerful CLI tool for bidirectional conversion between JSON, YAML, TOML, and ENV config formats.
Features
- Bidirectional Conversion: Convert between any combination of supported formats
- Smart Type Inference: Automatically detect and convert string values to appropriate Python types
- Syntax Validation: Validate syntax of input files before conversion
- Flatten/Unflatten: Transform nested structures to/from dot-notation keys
- Schema Generation: Generate JSON Schema from parsed configurations
- Shell Completion: Built-in support for bash, zsh, and fish completions
- Offline Operation: Runs entirely offline with minimal dependencies
Installation
pip install config-convert-cli
Usage
Convert between formats
# Convert JSON to YAML
config-convert convert input.json --to yaml -o output.yaml
# Convert YAML to JSON
config-convert convert config.yaml --from yaml --to json
# Convert ENV to JSON
config-convert convert .env --from env --to json
# Pretty print output
config-convert convert config.json --to yaml --pretty
Validate syntax
config-validate config.yaml
Flatten nested structures
config-convert flatten config.json --output flat.env
Unflatten to nested structures
config-convert unflatten flat.env --output nested.yaml
Generate JSON Schema
config-convert schema config.json -o schema.json
Supported Formats
| Format | Extension | Read | Write |
|---|---|---|---|
| JSON | .json | ✓ | ✓ |
| YAML | .yaml | ✓ | ✓ |
| TOML | .toml | ✓ | ✓ |
| ENV | .env | ✓ | ✓ |
Shell Completion
Bash
# Install completions
config-convert --install-completion bash
# Or source directly
source <(config-convert --show-completion bash)
Zsh
config-convert --install-completion zsh
Fish
config-convert --install-completion fish
Exit Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | File not found |
| 4 | Syntax error in input |
| 5 | Conversion error |
License
MIT