这为什么不起作用:
curl -s http://api.icndb.com/jokes/random/3 | jq '.[] | .joke'
jq: error (at <stdin>:0): Cannot index string with string "joke"
这是什么时候
jq '.[] | .joke' jokes.json
"Chuck Norris hosting is 101% uptime guaranteed."
"The crossing lights in Chuck Norris's home town say "Die slowly" and "die quickly". They each have a picture of Chuck Norris punching or kicking a pedestrian."
"When in a bar, you can order a drink called a "Chuck Norris". It is also known as a "Bloody Mary", if your name happens to be Mary."
答案 0 :(得分:2)
curl -s http://api.icndb.com/jokes/random/3 | jq '.value[].joke'
在这里工作正常。