--json flag. JSON (JavaScript Object Notation) is a structured data format that scripts and programs can easily parse. Use this when you want to process command output programmatically instead of reading it as plain text.
Enabling JSON Output
Add--json to any command:
Output Format
Success Response
Error Response
Command-Specific Output
mizu version --json
mizu new --list --json
mizu new --json
Success:
mizu new --dry-run --json
Same format as mizu new --json, but files are not written:
mizu dev --json
The dev command emits NDJSON (newline-delimited JSON) with lifecycle events:
Event Types
Event Schema
Error Codes
Parsing JSON Output
jq Examples
Bash Script
Python
Go
Streaming Events (mizu dev)
Formizu dev --json, parse events line by line:
Bash
Node.js
Best Practices
Always Handle Both Success and Error
Capture stderr for Errors
Use jq for Safe Parsing
See Also
- Global Flags - All CLI flags including
--json - Exit Codes - Return codes for automation
- mizu dev - Development server with streaming events