Output Formats
Control how the CLI formats command output.
Available Formats
YAML (Default)
Human-readable structured output.
When to use:
- Interactive terminal use
- Reading output directly
- Debugging and development
Example:
dot-ai version
Output:
version: 1.2.1
server:
version: 1.2.1
healthy: true
JSON
Raw API response, machine-parseable.
When to use:
- Scripting and automation
- Piping to other tools (jq, etc.)
- AI agents processing output
- CI/CD pipelines
Example:
dot-ai version --output json
Output:
{
"version": "1.2.1",
"server": {
"version": "1.2.1",
"healthy": true
}
}
Setting Output Format
Command-line flag:
dot-ai <command> --output json
dot-ai <command> --output yaml
Environment variable:
export DOT_AI_OUTPUT_FORMAT="json"
dot-ai <command>
Default: yaml
Processing Output
Extract fields with jq:
dot-ai version --output json | jq '.server.version'
Filter arrays:
dot-ai resources --kind Deployment --output json | jq '.items[] | .metadata.name'
Combine with other tools:
dot-ai resources --kind Pod --output json | jq -r '.items[].metadata.name' | xargs -I {} echo "Pod: {}"
For AI Agents
AI agents should use JSON output for structured parsing:
dot-ai <command> --output json
This ensures consistent, parseable responses without YAML formatting ambiguities.
Next Steps
- Automation — Use output in scripts and CI/CD
- Commands Overview — See all available commands
- Configuration — Set default output format