Skip to main content

Output formats

Shoplazza CLI supports multiple output formats and filtering options for flexible data handling.

Format flag

Use the global --format flag on any command:

shoplazza products +search --keyword "shirt" --format <format>
FormatDescriptionBest for
jsonStructured JSON (default)Scripting, AI agents, piping
prettyHuman-readable key-value pairsQuick inspection
tableTab-separated table with headersTerminal viewing

JSON (default)

shoplazza products list
{
"ok": true,
"action": "products.list",
"data": {
"products": [...]
}
}

Pretty

shoplazza products list --format pretty

Displays sorted key-value pairs for easy reading.

Table

shoplazza products list --format table

Renders a tab-separated table with column headers.

Filtering with --jq

Filter and transform JSON output using jq expressions:

# Extract product titles
shoplazza products list --jq '.data.products[].title'

# Select specific fields
shoplazza orders list --jq '.data.orders[] | {id, status, total_price}'

# Count results
shoplazza products list --jq '.data.products | length'

The -q flag is a shorthand alias for --jq.

Field projection with --fields

Shortcuts support --fields for selecting output columns:

shoplazza products +search --keyword "shirt" --fields "id,title,price" --format table

Dry run

Preview the HTTP request without executing it:

shoplazza products list --dry-run

This shows the method, URL, headers, and body that would be sent, without making the actual API call. Useful for debugging and learning the API.

Output conventions

stdout vs stderr

  • stdout — Data output (JSON envelopes). Safe to pipe and parse.
  • stderr — Progress indicators, warnings, and hints. Human-readable.

This separation ensures you can safely pipe CLI output:

shoplazza products list --jq '.data.products[].id' | xargs -I {} shoplazza products get --id {}

Success envelope

{
"ok": true,
"action": "products.list",
"data": { ... }
}

Error envelope

{
"error": {
"type": "api",
"message": "Product not found",
"hint": "Check the product ID and try again"
},
"request_id": "req_abc123"
}

See Error format for details.