Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

jq and suppressing standard error message (which does not appear to be error) [closed]

$
0
0

I have JSON output from curl query I did and I am creating another array which later on I will use to create HTML (or CSV and then HTML) in step by step process. However, I always get a what jq says is error though I see it as informative message as command as such works just fine.

This I can reproduce from CLI and script (where I actually noticed it first) jq provides error statement which is not actually error as exit code is 0 and output provided is correct. In essence, I run something like this:

/bin/jq 'map (select (.completionStatus == "Failed") | {"Type" : .type, "Start Time" : .startTime, "Command" : .command, "End Time" : .endTime, "Workflow" : .workflowName, "Run On Host" : .runOnHost, "Error message" : .message})' inputfile

The error is:

jq: error (at inputfile:1): Cannot iterate over number (810)

Of course, input file has 810 lines and all is well. I can redirect error to null (and that works by just adding 2> /dev/null), but I assume there must be something neater.


Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>