更新时间:2023-01-11 16:38:12
如果可能的话,一般应该避免拖拉.如果您的jq具有input
,则可以简单地写:
Slurping should, in general, be avoided if possible. If your jq has input
, you could simply write:
echo '{"a":0,"b":{"c":"C"}}{"x":33}{"asd":889}' |
jq -n input
如果您的jq没有input
,那么现在是升级到jq 1.6的好时机.如果这不是一个选项,则一定要使用-s选项,例如jq -s '.[0]'
If your jq does not have input
, now would be a great time to upgrade to jq 1.6. If that is not an option, then by all means use the -s option, e.g. jq -s '.[0]'