I am trying to following the manual and examples out there and its not especially clear on how to handle colons element name if you want to specifically within a JQ output without outputting the entire structure.
Raw:{"UpdateResponseMessage":{"Header":{"com:TransactionID":"5e5b1750-7be7-11e8-886a-838029aca397","com:TimeStamp":"2018-06-29T21:57:08.549Z","com:SourceSystem":"Call","com:Status":"Success"}},"level":"info","message":"UpdateResponseMessage being sent.","timestamp":"2018-06-29T21:57:08.549Z"}
The output of jq-win64 [.] test.log
is the following:
[ {
"UpdateResponseMessage": {
"Header": {
"com:TransactionID": "5e5b1750-7be7-11e8-886a-838029aca397",
"com:TimeStamp": "2018-06-29T21:57:08.549Z",
"com:SourceSystem": "Call",
"com:Status": "Success"
}
},
]
I am attempting to call just "com:Status" and "com:TransactionID" but it either gives me a syntax error (INVALID_CHARACTER) or turns out no data "null" with everything I have tried.
The following outputs "null" for TransactionID and Status.
There were previous reports of people trying to figure out (issue 741, 745 with the suggestion to use jq <x.json '.["key::name"]'
and similar questions the above code for JSON.net as well as some variations have tried to follow the guidance but the JQ manual has no examples specifically addressing this situation either.
The following at least doesn't error, but it doesn't output the values, just "NULL" for the two elements containing the ":" in their name.. if I add the ``` mark like I have in the commented out field I get "Invalid_Character" again.
elif .UpdateResponseMessage then
# ( .UpdateResponseMessage .Header | [`.["com::TransactionID"]`] )
( .UpdateResponseMessage .Header | ["Response", `.["com::TransactionID"], .["com::Status"]] )
Output:
"Response","null","null"
But what I need is:
"Response","5e5b1750-7be7-11e8-886a-838029aca397","Success"