JSON Output

June 12, 2026 ยท View on GitHub

Some commands support JSON output format for easy integration with scripts, APIs, and external tools.

Usage

Add --json or -j flag to supported commands:

madock status --json
madock config:list -j

Response Format

All JSON responses follow a consistent structure:

Success:

{
  "success": true,
  "data": { ... }
}

Error:

{
  "success": false,
  "error": "Error message"
}

Supported Commands

status

Shows container states, proxy status, and tools status.

madock status --json

Response:

{
  "success": true,
  "data": {
    "services": [
      {"name": "php-container", "service": "php", "state": "running", "running": true},
      {"name": "nginx-container", "service": "nginx", "state": "running", "running": true},
      {"name": "db-container", "service": "db", "state": "exited", "running": false}
    ],
    "proxy": [
      {"name": "proxy-container", "service": "proxy", "state": "running", "running": true}
    ],
    "tools": {
      "cron_enabled": false,
      "debugger_enabled": true
    }
  }
}

config:list

Shows all project configuration parameters.

madock config:list --json

Response:

{
  "success": true,
  "data": {
    "project": "myproject",
    "config": {
      "platform": "magento2",
      "php/version": "8.2",
      "db/version": "10.6",
      "nginx/hosts/base/name": "myproject.test"
    }
  }
}

scope:list

Shows all available scopes with active scope marker.

madock scope:list --json

Response:

{
  "success": true,
  "data": {
    "scopes": [
      {"name": "default", "active": true},
      {"name": "staging", "active": false}
    ],
    "active": "default"
  }
}

service:list

Shows all services with their enabled/disabled status.

madock service:list --json

Response:

{
  "success": true,
  "data": {
    "services": [
      {"name": "elasticsearch", "enabled": true},
      {"name": "redis", "enabled": true},
      {"name": "rabbitmq", "enabled": false},
      {"name": "xdebug", "enabled": false}
    ]
  }
}

db:info

Shows database connection details.

madock db:info --json

Response:

{
  "success": true,
  "data": {
    "databases": [
      {
        "name": "First DB",
        "host": "db",
        "database": "magento",
        "user": "magento",
        "password": "magento",
        "root_password": "root",
        "remote_host": "localhost",
        "remote_port": 33060
      },
      {
        "name": "Second DB",
        "host": "db2",
        "database": "magento",
        "user": "magento",
        "password": "magento",
        "root_password": "root",
        "remote_host": "localhost",
        "remote_port": 33061
      }
    ]
  }
}

db:export

Exports the database and returns the path of the created dump file. The dump is produced inside the database container, so no PHP or database client is required on the host.

madock db:export --json

Response:

{
  "success": true,
  "data": {
    "file": "/path/to/madock/projects/myproject/backup/db/local_2026-06-12_13-38-56.sql.gz"
  }
}

Examples

Get database password with jq

madock db:info --json | jq -r '.data.databases[0].password'

Check if container is running

madock status --json | jq -r '.data.services[] | select(.service == "php") | .running'

Get PHP version from config

madock config:list --json | jq -r '.data.config["php/version"]'

List enabled services

madock service:list --json | jq -r '.data.services[] | select(.enabled == true) | .name'