Everything you need to work with YAML files: validate syntax, format/prettify, convert to/from JSON, query with dot-path expressions, merge multiple files, and check against a schema.
bash
# Validate YAML syntax
python3 scripts/yaml_toolkit.py validate config.yaml
# Format/prettify YAML
python3 scripts/yaml_toolkit.py format messy.yaml
# Convert YAML to JSON
python3 scripts/yaml_toolkit.py to-json config.yaml
# Convert JSON to YAML
python3 scripts/yaml_toolkit.py from-json data.json
# Query a value by dot-path
python3 scripts/yaml_toolkit.py get config.yaml "server.host"
# Set a value
python3 scripts/yaml_toolkit.py set config.yaml "server.port" 8080
# Merge multiple YAML files (later files override earlier)
python3 scripts/yaml_toolkit.py merge base.yaml override.yaml
# Lint against a simple schema file
python3 scripts/yaml_toolkit.py lint config.yaml --schema schema.yaml
# List all keys (flattened dot-path)
python3 scripts/yaml_toolkit.py keys config.yaml
# Minify YAML (single-line flow style)
python3 scripts/yaml_toolkit.py minify config.yaml
CommandDescriptionvalidate <file>Check YAML syntax, report errors with line numbersformat <file>Pretty-print YAML with consistent indentationto-json <file>Convert YAML to JSONfrom-json <file>Convert JSON to YAMLget <file> <path>Get value at dot-path (e.g. server.host)set <file> <path> <val>Set value at dot-path, output updated YAMLmerge <file1> <file2> ...Deep-merge YAML files (right overrides left)lint <file> --schema <s>Validate keys against a schema YAMLkeys <file>List all keys as flattened dot-pathsminify <file>Output compact single-line YAML
FlagDescription--output <file>Write output to file instead of stdout--indent NIndentation spaces (default: 2)--allow-unicodeAllow unicode in output (default: true)
0 — Success1 — Validation error or key not found2 — File not found or parse error