$ ps --libxo=json | jq
{
"process-information": {
"process": [
{
"pid": "41389",
"terminal-name": "0 ",
"state": "Is",
"cpu-time": "0:00.01",
"command": "-bash (bash)"
},
[...]
It's not perfect though. ls had support, but it was removed for reasons[1]. It's not supported by all of the utilities, etc.This seems to be a great stop-gap with parsers for a LOT of different commands, but it relies on parsing text output that's not necessarily designed to be parsed. It would be nice if utilities coalesced around a common flag to emit structured output.
In PowerShell, structured output is the default and it seems to work very well. This is probably too far for Unix/Linux, but a standard "--json" flag would go a long way to getting the same benefits.