Feature Request: Machine Readable / JSON output format

Hello!

Huge fan of pv. I use pv daily in multi-process pipelines and streaming between child processes. Currently, I'm looking to programmatically monitor pv's output in my automation scripts to drive a multi-node work coordinator.

Feature request:

  • Add JSON output formatting through a new flag (e.g. --json). This would provide machine-readable output that's reliably parseable (JSON detection can start with a simple { check, unlike parsing stderr for a custom format which may contain other messages).

Alternative suggestions:

  • Extend --numeric to work in combination with custom format strings. It seems like these two don't work in combination (at least in the version in Ubuntu/Debian).
  • If one could pass a JSON template into the custom format, and --numeric would pass raw values ... it might not be necessary to natively support this.

I'm interested in contributing this feature if you're open to pull requests. Would appreciate guidance on:

  1. Preferred JSON library (if any) vs simple string templating
  2. Any specific format requirements or preferences

🎉 Thanks for maintaining this essential tool!

Hello! Huge fan of `pv`. I use `pv` daily in multi-process pipelines and streaming between child processes. Currently, I'm looking to programmatically monitor `pv`'s output in my automation scripts to drive a multi-node work coordinator. **Feature request:** - Add JSON output formatting through a new flag (e.g. `--json`). This would provide machine-readable output that's reliably parseable (JSON detection can start with a simple `{` check, unlike parsing stderr for a custom format which may contain other messages). **Alternative suggestions:** - Extend `--numeric` to work in combination with custom format strings. It seems like these two don't work in combination (at least in the version in Ubuntu/Debian). - If one could pass a JSON template into the custom format, and `--numeric` would pass raw values ... it might not be necessary to natively support this. **I'm interested in contributing this feature if you're open to pull requests.** Would appreciate guidance on: 1. Preferred JSON library (if any) vs simple string templating 2. Any specific format requirements or preferences ### 🎉 Thanks for maintaining this essential tool!