Store the json blobs in temporary files instead of variables, and feed
them to jq for parsing.
When echoing "\n", the new line will become a literal new line, and
therefore, invalid json input:
jq: parse error: Invalid string: control characters from U+0000 through U+001F must be escaped ...
To reproduce:
% git arc patch -c D12345