WP Debug Toolkit 1.2.0 is LIVE. Get $300 discount on the lifetime deal now
Use Discount Code WPDTLTD
Get WP Debug Toolkit

Add --format=json, --format=csv, or --format=table to any wp dbtk command that supports it to control how output prints. table is the default for most commands, but json works on every command that accepts --format at all, making it the safe default for scripts, CI pipelines, and AI coding agent workflows. markdown is a separate special case: it is the default output of wp dbtk api bootstrap only and is not available on other commands.

Overview

The --format flag controls the shape of the data a wp dbtk command returns. It could be either human-readable columns and rows printed to the terminal or structured data for a script to parse. Not every command supports every format, and a few commands have fixed output with no --format flag at all. For full command syntax, see CLI Command Reference.

Format Values

Format ValueWhat It Produces and When to Use It
table (default for most commands)Human-readable columns and rows printed to the terminal. Use this when running a command interactively and reading the output directly.
jsonStructured JSON output. Every command that accepts --format supports json. Use this when piping output to jq, parsing in a script, or passing results to an AI coding agent.
csvComma-separated values. Available on wp dbtk log read and wp dbtk query-log read. Use this when exporting log or query data to a spreadsheet or external analysis tool.
markdown (default for api bootstrap)Formatted Markdown text. Available on wp dbtk api bootstrap only, where it is the default. api bootstrap handles this format through its own code path rather than the shared format system, so --format=markdown has no effect on any other command. Use this when pasting the output directly into an AI agent’s chat or system prompt.

Commands with Non-Standard Format Behavior

A few commands don’t follow the standard table/json pattern.

CommandFormat Behavior
wp dbtk api discoverNo --format flag exists. Output format is fixed.
wp dbtk api call--format=json is the only option. No table output.
wp dbtk api export--format=json is the only option, matching its purpose as a portable file format.
wp dbtk api editNo --format flag exists. The command returns a fixed success or error message confirming whether the annotation saved.
wp dbtk api importNo --format flag exists. The command returns a fixed success or error message reporting how many routes were affected.

Piping JSON to jq

json output from wp dbtk commands works directly with jq for filtering and extraction.

bash

# Get all REST routes as JSON, then extract just the route paths with jq

# Note: api list outputs capitalized keys (Route, Methods, Source, Description)

wp dbtk api list --format=json | jq '.[] | .Route'

# Filter to slow queries and pull out the SQL text only

# Note: query-log read outputs lowercase keys (sql, component, type, time)

wp dbtk query-log read --slow --format=json | jq '.[] | .sql'

Related Documentation

CLI Command Reference – Look up every wp dbtk command and check which format options it accepts before you script against it.

How to Use WP Debug Toolkit with AI Coding Assistants – Feed wp dbtk api bootstrap output straight into an AI agent’s context, or pipe other commands’ JSON output into your agent’s workflow.

On this page
Try WP Debug Toolkit
The best error log viewer with amazing developer tools to help you troubleshoot your WordPress site securely and efficiently. Something something more.