bitcoin-cli JSON-serialized error output Is there a way to make bitcoin-cli output JSON-serialized errors? For example if I do

bitcoin-cli getblock foo


the output is

error code: -5
error message:
Block not found


I want the output to be something more like:

{
  "error": {
    "code": -5,
    "message": "Block not found"
  }
}


Behind the scenes, that's what the RPC response body looks like, and I want to tell bitcoin-cli, "Don't pretty-print the error if there is one. Just give me the JSON response."
bitcoin-cli does not currently support dumping the raw JSON-RPC response. The relevant section of the Bitcoin Core code is here https://github.com/bitcoin/bitcoin/blob/2753285be72dd051cf2987ca5c80d0b149914020/src/bitcoin-cli.cpp#L455 .