JSON output

The three output modes, what each is for, and which one is stable.

5 sections2 min read

Three modes, in order of precedence. Pick the one that matches who is reading.

The threebash
cf reproduced --agent                 # one line of JSON, stable envelope
cf reproduced --json                  # the raw API response, pretty printed
cf reproduced | grep critical         # tab separated lines when piped

--agent

The supported machine interface. One line of JSON on stdout, a stable envelope, structured errors, and never interactive. This is what a script or a coding agent should use. See Agent mode.

cf reproduced --agentjson
{
  "schemaVersion": 1,
  "ok": true,
  "command": "reproduced",
  "data": {
    "repository": "acme/api",
    "total": 32,
    "counts": { "critical": 5, "high": 14 },
    "findings": []
  },
  "next": ["cf reproduced show <id> --repo acme/api --agent"]
}

--json

The unmodified API response, pretty printed. Useful for exploring what a route actually returns, and for one-off jq work. It is not a stable contract: fields come and go with the API.

Exploringbash
cf reproduced --json | jq '.findings[] | select(.severity == "critical") | .filePath'
cf repo list --json | jq -r '.[].fullName'
cf settings --json | jq '.checks'

Piped

With no flag and no terminal, the tables and their headings are dropped and the same command prints tab separated lines instead. Fine for a quick grep. Not something to build on, because the columns are chosen for reading rather than parsing. See Reading the output.

Which to use

ReaderModeWhy
A coding agent--agentStable envelope, structured errors, compact payloads.
A CI job deciding pass or fail--exit-codeNo parsing at all.
A script that needs one field--agent and jqThe envelope is stable, so the script does not break on an API change.
You, exploring--jsonEverything the API returned, unmodified.

Size

Have a correction or need help?

Email the docs team