shell中处理json数据工具jq
container_id=f4810fec374a096895c90e1c74574a7d69e5ec306ea8fe0817e461c28b3da716
cat /var/run/docker/libcontainerd/${container_id}/config.json | python -m json.tool{
"annotations": {
"__BlkBufferWriteBps": "0",
"__BlkBufferWriteSwitch": "0",
...curl -s 'http://api.icndb.com/jokes/random' \
| python -m json.tool \
| grep '\"joke\"' \
| cut -d ':' -f 2 \
| sed 's/"/\"/g'jq处理array
使用jq创建对象
去除引号
多字段提取方法
json字符串错误INvalid string
INvalid string参考
Last updated