Skip to content

CLI-03: Switch to JSON output

–format json emits the raw Finding[] array for machine parsing.

Builds on: CLI-02: Read a single human finding with line:col

A terminal session: the command as you’d run it, followed by the output it prints; trailing comments note the exit status.

Terminal window
# same run, machine-readable: --format json emits the raw Finding[] (no run summary)
markdown-contract validate ./decisions --contract decisions.contract.yaml --format json
[
{
"id": "structure/section-missing",
"level": "error",
"path": "D-9001.md",
"message": "required section ‘Decision’ is missing",
"pos": {
"line": 8,
"col": 1
}
}
]
# exit status: 1 (error-level findings)
  • --format json
  • formatJson (Finding[] verbatim, JSON.parse round-trips)