{"id":2612,"date":"2026-09-01T14:11:28","date_gmt":"2026-09-01T06:11:28","guid":{"rendered":"https:\/\/www.54iter.cn\/?software=jq%ef%bc%9a%e5%91%bd%e4%bb%a4%e8%a1%8c-json-%e5%a4%84%e7%90%86%e7%a5%9e%e5%99%a8"},"modified":"2026-09-01T14:11:28","modified_gmt":"2026-09-01T06:11:28","slug":"jq%ef%bc%9a%e5%91%bd%e4%bb%a4%e8%a1%8c-json-%e5%a4%84%e7%90%86%e7%a5%9e%e5%99%a8","status":"publish","type":"software","link":"https:\/\/www.54iter.cn\/?software=jq%ef%bc%9a%e5%91%bd%e4%bb%a4%e8%a1%8c-json-%e5%a4%84%e7%90%86%e7%a5%9e%e5%99%a8","title":{"rendered":"jq\uff1a\u547d\u4ee4\u884c JSON \u5904\u7406\u795e\u5668"},"content":{"rendered":"<p>jq \u662f\u547d\u4ee4\u884c\u4e0b\u7684 JSON \u5904\u7406\u5de5\u5177\uff0c\u7528\u7c7b\u4f3c\u7ba1\u9053\u7684\u65b9\u5f0f\u5bf9 JSON \u6570\u636e\u505a\u8fc7\u6ee4\u3001\u53d6\u503c\u3001\u53d8\u6362\u4e0e\u683c\u5f0f\u5316\uff0c\u662f\u8fd0\u7ef4\u811a\u672c\u91cc\u89e3\u6790 API \u8fd4\u56de\u548c\u65e5\u5fd7\u7684\u5fc5\u5907\u795e\u5668\u3002<\/p>\n<h2>\u6838\u5fc3\u4f18\u70b9<\/h2>\n<ul>\n<li><strong>\u5355\u4e8c\u8fdb\u5236<\/strong>\uff1a\u65e0\u9700\u4f9d\u8d56\uff0c\u4e0b\u8f7d\u5373\u53ef\u7528\uff0c\u811a\u672c\u53cb\u597d\u3002<\/li>\n<li><strong>\u5f3a\u5927\u8868\u8fbe\u5f0f<\/strong>\uff1a\u53d6\u503c\u3001\u6570\u7ec4\u64cd\u4f5c\u3001\u6761\u4ef6\u8fc7\u6ee4\u3001\u5b57\u7b26\u4e32\u5904\u7406\u4e00\u5e94\u4ff1\u5168\u3002<\/li>\n<li><strong>\u7ba1\u9053\u5316<\/strong>\uff1a\u4e0e curl\u3001grep \u7b49\u547d\u4ee4\u5929\u7136\u8854\u63a5\u3002<\/li>\n<li><strong>\u8f93\u51fa\u7f8e\u5316<\/strong>\uff1a\u683c\u5f0f\u5316\/\u538b\u7f29 JSON\uff0c\u65e5\u5fd7\u6392\u969c\u76f4\u89c2\u3002<\/li>\n<\/ul>\n<h2>\u5feb\u901f\u4e0a\u624b<\/h2>\n<pre><code># \u5b89\u88c5\uff08Debian\/Ubuntu\uff09\napt install jq\n\n# \u89e3\u6790 API \u8fd4\u56de\ncurl -s https:\/\/api.example.com\/status | jq '.data.cpu'\n\n# \u6570\u7ec4\u4e0e\u8fc7\u6ee4\ncurl -s https:\/\/api.example.com\/hosts | jq '.[] | select(.status==\"down\")'\n\n# \u63d0\u53d6\u5b57\u6bb5\u5230\u53d8\u91cf\nIP=$(curl -s https:\/\/api.example.com\/ip | jq -r '.ip')\necho \"\u5f53\u524d IP: $IP\"<\/code><\/pre>\n<h2>\u9002\u7528\u573a\u666f<\/h2>\n<p>\u76d1\u63a7\u63a5\u53e3\u6570\u636e\u63d0\u53d6\u3001\u5bb9\u5668\/\u4e91\u5e73\u53f0 API \u81ea\u52a8\u5316\u3001\u65e5\u5fd7 JSON \u89e3\u6790\u3001\u914d\u7f6e\u6a21\u677f\u6e32\u67d3\u524d\u7684\u6570\u636e\u6574\u7406\u3002<\/p>\n<h2>\u4e0b\u8f7d\u5730\u5740<\/h2>\n<ul>\n<li><strong>\u5b98\u65b9\u7f51\u7ad9<\/strong>\uff1a<a href=\"https:\/\/jqlang.github.io\/jq\/\" target=\"_blank\" rel=\"noopener nofollow\">https:\/\/jqlang.github.io\/jq\/<\/a><\/li>\n<li><strong>GitHub \u4ed3\u5e93<\/strong>\uff1a<a href=\"https:\/\/github.com\/jqlang\/jq\" target=\"_blank\" rel=\"noopener nofollow\">https:\/\/github.com\/jqlang\/jq<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u8f7b\u91cf\u7ea7\u547d\u4ee4\u884c JSON \u89e3\u6790\u5668\uff0c\u5904\u7406 API \u8fd4\u56de\u3001\u65e5\u5fd7\u4e0e\u914d\u7f6e\u7684\u5fc5\u5907\u5de5\u5177\u3002<\/p>\n","protected":false},"featured_media":0,"template":"","categories":[154],"tags":[],"class_list":["post-2612","software","type-software","status-publish","hentry","category-operating-systems"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/software\/2612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/software"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/software"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}