Skip to content

EMBED-AND-CI-07: Parse JSON findings in a script

Emitting –format json and processing the stable Finding[] shape downstream.

Builds on: EMBED-AND-CI-05: Fail CI on the exit code

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

Terminal window
npx markdown-contract validate docs/planning --format json \
| jq -r '.[] | select(.level=="error") | "\(.path):\(.pos.line) \(.id)"'
# each element is a Finding: { id, level, path, pos:{line,col}, message, fix? }
  • CLI --format json
  • formatJson
  • Finding shape (id, level, path, pos, message)