{"id":50714,"date":"2022-08-04T05:48:51","date_gmt":"2023-04-09T23:45:06","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/"},"modified":"2024-01-15T13:17:17","modified_gmt":"2024-01-15T05:17:17","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e"},"content":{"rendered":"<h3>\u7b80\u4ecb<\/h3>\n<p>\u5728\u5904\u7406\u5927\u578bJSON\u6587\u4ef6\u65f6\uff0c\u5f88\u96be\u627e\u5230\u548c\u64cd\u4f5c\u6240\u9700\u7684\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u590d\u5236\u548c\u7c98\u8d34\u6240\u6709\u76f8\u5173\u7247\u6bb5\u624b\u52a8\u8ba1\u7b97\u603b\u6570\uff0c\u4f46\u8fd9\u662f\u4e00\u4e2a\u8017\u65f6\u7684\u8fc7\u7a0b\uff0c\u4e5f\u5bb9\u6613\u51fa\u9519\u3002\u53e6\u4e00\u4e2a\u9009\u62e9\u662f\u4f7f\u7528\u901a\u7528\u7684\u5de5\u5177\u6765\u67e5\u627e\u548c\u64cd\u4f5c\u4fe1\u606f\u3002\u6240\u6709\u73b0\u4ee3Linux\u7cfb\u7edf\u90fd\u9884\u88c5\u4e86\u4e09\u4e2a\u5df2\u5efa\u7acb\u7684\u6587\u672c\u5904\u7406\u5de5\u5177\uff0c\u5373sed\u3001awk\u548cgrep\u3002\u867d\u7136\u5728\u5904\u7406\u677e\u6563\u7ed3\u6784\u5316\u6570\u636e\u65f6\u8fd9\u4e9b\u547d\u4ee4\u5f88\u6709\u7528\uff0c\u4f46\u5728\u5904\u7406\u7c7b\u4f3cJSON\u8fd9\u6837\u7684\u53ef\u673a\u5668\u8bfb\u53d6\u7684\u6570\u636e\u683c\u5f0f\u65f6\uff0c\u8fd8\u6709\u5176\u4ed6\u9009\u62e9\u3002<\/p>\n<p>jq\u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u7684JSON\u5904\u7406\u5de5\u5177\uff0c\u5bf9\u4e8e\u5904\u7406\u673a\u5668\u53ef\u8bfb\u683c\u5f0f\u7684\u6570\u636e\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u5c24\u5176\u5728Shell\u811a\u672c\u4e2d\u7279\u522b\u6709\u7528\u3002\u4f7f\u7528jq\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5904\u7406\u6570\u636e\u3002\u4f8b\u5982\uff0c\u5f53\u4f60\u8fd0\u884c\u4e00\u4e2a\u9488\u5bf9JSON API\u7684curl\u8c03\u7528\u65f6\uff0cjq\u53ef\u4ee5\u4ece\u670d\u52a1\u5668\u7684\u54cd\u5e94\u4e2d\u63d0\u53d6\u7279\u5b9a\u7684\u4fe1\u606f\u3002\u4f5c\u4e3a\u6570\u636e\u5de5\u7a0b\u5e08\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5c06jq\u7eb3\u5165\u5230\u6570\u636e\u6444\u53d6\u8fc7\u7a0b\u4e2d\u3002\u5982\u679c\u4f60\u7ba1\u7406\u4e00\u4e2aKubernetes\u96c6\u7fa4\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528kubectl\u7684JSON\u8f93\u51fa\u4f5c\u4e3ajq\u7684\u8f93\u5165\u6e90\uff0c\u4ece\u4e2d\u63d0\u53d6\u7279\u5b9a\u90e8\u7f72\u53ef\u7528\u526f\u672c\u7684\u6570\u91cf\u3002<\/p>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u60a8\u5c06\u4f7f\u7528jq\u6765\u8f6c\u6362\u4e00\u4e2a\u5173\u4e8e\u6d77\u6d0b\u52a8\u7269\u7684\u793a\u4f8bJSON\u6587\u4ef6\u3002\u60a8\u5c06\u4f7f\u7528\u8fc7\u6ee4\u5668\u5e94\u7528\u6570\u636e\u8f6c\u6362\uff0c\u5e76\u5c06\u8f6c\u6362\u540e\u7684\u6570\u636e\u7ec4\u5408\u6210\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u7ed3\u6784\u3002\u901a\u8fc7\u672c\u6559\u7a0b\u7684\u7ed3\u675f\uff0c\u60a8\u5c06\u80fd\u591f\u4f7f\u7528jq\u811a\u672c\u6765\u56de\u7b54\u6709\u5173\u60a8\u5df2\u64cd\u4f5c\u7684\u6570\u636e\u7684\u95ee\u9898\u3002<\/p>\n<h2>\u5148\u51b3\u6761\u4ef6<\/h2>\n<p>\u5b8c\u6210\u672c\u6559\u7a0b\uff0c\u60a8\u9700\u8981\u4ee5\u4e0b\u7269\u54c1\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>jq, a JSON parsing and transformation tool. It is available from the repositories for all major Linux distributions. If you are using Ubuntu, run sudo apt install jq to install it.<\/li>\n<li>An understanding of JSON syntax, which you can refresh in An Introduction to JSON.<\/li>\n<\/ul>\n<h2>\u7b2c\u4e00\u6b65\u2014\u6267\u884c\u60a8\u7684\u7b2c\u4e00\u4e2ajq\u547d\u4ee4\u3002<\/h2>\n<p>\u5728\u8fd9\u4e00\u6b65\u4e2d\uff0c\u60a8\u5c06\u8bbe\u7f6e\u6837\u672c\u8f93\u5165\u6587\u4ef6\uff0c\u5e76\u901a\u8fc7\u8fd0\u884cjq\u547d\u4ee4\u6765\u6d4b\u8bd5\u8bbe\u7f6e\uff0c\u4ee5\u751f\u6210\u6837\u672c\u6587\u4ef6\u6570\u636e\u7684\u8f93\u51fa\u3002jq\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u7ba1\u9053\u83b7\u53d6\u8f93\u5165\u3002\u60a8\u5c06\u4f7f\u7528\u524d\u8005\u3002<\/p>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u751f\u6210\u793a\u4f8b\u6587\u4ef6\u3002\u4f7f\u7528\u60a8\u504f\u597d\u7684\u7f16\u8f91\u5668\uff08\u672c\u6559\u7a0b\u4f7f\u7528nano\uff09\u521b\u5efa\u5e76\u6253\u5f00\u4e00\u4e2a\u540d\u4e3aseaCreatures.json\u7684\u65b0\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\"><span class=\"token function\">nano<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5c06\u4ee5\u4e0b\u5185\u5bb9\u590d\u5236\u5230\u6587\u4ef6\u4e2d\u3002<\/p>\n<div>\u6d77\u6d0b\u751f\u7269.json<\/div>\n<pre class=\"post-pre\"><code><span class=\"token punctuation\">[<\/span>\r\n    <span class=\"token punctuation\">{<\/span> <span class=\"token property\">\"name\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"Sammy\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"type\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"shark\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"clams\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">5<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>\r\n    <span class=\"token punctuation\">{<\/span> <span class=\"token property\">\"name\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"Bubbles\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"type\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"orca\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"clams\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">3<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>\r\n    <span class=\"token punctuation\">{<\/span> <span class=\"token property\">\"name\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"Splish\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"type\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"dolphin\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"clams\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">2<\/span> <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span>\r\n    <span class=\"token punctuation\">{<\/span> <span class=\"token property\">\"name\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"Splash\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"type\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token string\">\"dolphin\"<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token property\">\"clams\"<\/span><span class=\"token operator\">:<\/span> <span class=\"token number\">2<\/span> <span class=\"token punctuation\">}<\/span>\r\n<span class=\"token punctuation\">]<\/span>\r\n<\/code><\/pre>\n<p>\u5728\u63a5\u4e0b\u6765\u7684\u6559\u7a0b\u4e2d\uff0c\u4f60\u5c06\u4f7f\u7528\u8fd9\u4e9b\u6570\u636e\u8fdb\u884c\u5de5\u4f5c\u3002\u5728\u6559\u7a0b\u7ed3\u675f\u65f6\uff0c\u4f60\u5c06\u5199\u51fa\u4e00\u884cjq\u547d\u4ee4\u6765\u56de\u7b54\u6709\u5173\u8fd9\u4e9b\u6570\u636e\u7684\u4ee5\u4e0b\u95ee\u9898\u3002<\/p>\n<ul class=\"post-ul\">\n<li>What are the names of the sea creatures in list form?<\/li>\n<li>How many clams do the creatures own in total?<\/li>\n<li>How many of those clams are owned by dolphins?<\/li>\n<\/ul>\n<p>\u4fdd\u5b58\u5e76\u5173\u95ed\u6587\u4ef6\u3002<\/p>\n<p>\u9664\u4e86\u8f93\u5165\u6587\u4ef6\u5916\uff0c\u60a8\u8fd8\u9700\u8981\u4e00\u4e2a\u63cf\u8ff0\u60a8\u5e0c\u671b\u6267\u884c\u7684\u786e\u5207\u8f6c\u6362\u7684\u8fc7\u6ee4\u5668\u3002\u70b9(.)\u8fc7\u6ee4\u5668\uff0c\u4e5f\u79f0\u4e3a\u8eab\u4efd\u8fd0\u7b97\u7b26\uff0c\u5c06JSON\u8f93\u5165\u4e0d\u53d8\u5730\u4f20\u9012\u4e3a\u8f93\u51fa\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u4f7f\u7528\u8eab\u4efd\u8fd0\u7b97\u7b26\u6765\u6d4b\u8bd5\u4f60\u7684\u8bbe\u7f6e\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\u3002\u5982\u679c\u4f60\u770b\u5230\u4efb\u4f55\u89e3\u6790\u9519\u8bef\uff0c\u8bf7\u68c0\u67e5seaCreatures.json\u662f\u5426\u5305\u542b\u6709\u6548\u7684JSON\u3002<\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u8eab\u4efd\u64cd\u4f5c\u7b26\u5e94\u7528\u4e8eJSON\u6587\u4ef6\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;.&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5f53\u4f7f\u7528jq\u5904\u7406\u6587\u4ef6\u65f6\uff0c\u60a8\u603b\u662f\u5148\u4f20\u9012\u4e00\u4e2a\u8fc7\u6ee4\u5668\uff0c\u7136\u540e\u662f\u8f93\u5165\u6587\u4ef6\u3002\u7531\u4e8e\u8fc7\u6ee4\u5668\u53ef\u80fd\u5305\u542b\u5bf9\u60a8\u7684shell\u5177\u6709\u7279\u6b8a\u542b\u4e49\u7684\u7a7a\u683c\u548c\u5176\u4ed6\u5b57\u7b26\uff0c\u6240\u4ee5\u6700\u597d\u5c06\u8fc7\u6ee4\u5668\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u3002\u8fd9\u6837\u505a\u4f1a\u544a\u8bc9\u60a8\u7684shell\uff0c\u8fc7\u6ee4\u5668\u662f\u4e00\u4e2a\u547d\u4ee4\u53c2\u6570\u3002\u8bf7\u653e\u5fc3\uff0c\u8fd0\u884cjq\u4e0d\u4f1a\u4fee\u6539\u60a8\u7684\u539f\u59cb\u6587\u4ef6\u3002<\/p>\n<p>\u60a8\u5c06\u6536\u5230\u4ee5\u4e0b\u7684\u8f93\u51fa\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ { &#8220;name&#8221;: &#8220;Sammy&#8221;, &#8220;type&#8221;: &#8220;shark&#8221;, &#8220;clams&#8221;: 5 }, { &#8220;name&#8221;: &#8220;Bubbles&#8221;, &#8220;type&#8221;: &#8220;orca&#8221;, &#8220;clams&#8221;: 3 }, { &#8220;name&#8221;: &#8220;Splish&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 }, { &#8220;name&#8221;: &#8220;Splash&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 } ]<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cjq\u4f1a\u5bf9\u5176\u8f93\u51fa\u8fdb\u884c\u6f02\u4eae\u6253\u5370\u3002\u5b83\u4f1a\u81ea\u52a8\u6dfb\u52a0\u7f29\u8fdb\uff0c\u5728\u6bcf\u4e2a\u503c\u4e4b\u540e\u6dfb\u52a0\u65b0\u884c\uff0c\u5e76\u5728\u53ef\u80fd\u65f6\u7ed9\u8f93\u51fa\u6dfb\u52a0\u989c\u8272\u3002\u7740\u8272\u53ef\u4ee5\u63d0\u9ad8\u53ef\u8bfb\u6027\uff0c\u8fd9\u5bf9\u8bb8\u591a\u5f00\u53d1\u4eba\u5458\u5728\u68c0\u67e5\u5176\u4ed6\u5de5\u5177\u751f\u6210\u7684JSON\u6570\u636e\u65f6\u975e\u5e38\u6709\u5e2e\u52a9\u3002\u4f8b\u5982\uff0c\u5f53\u5411JSON API\u53d1\u9001curl\u8bf7\u6c42\u65f6\uff0c\u60a8\u53ef\u80fd\u60f3\u5c06JSON\u54cd\u5e94\u5bfc\u5165jq &#8216;.&#8217;\u4ee5\u8fdb\u884c\u6f02\u4eae\u6253\u5370\u3002<\/p>\n<p>\u60a8\u73b0\u5728\u5df2\u7ecf\u5b89\u88c5\u5e76\u8fd0\u884c\u4e86jq\u3002\u8bbe\u7f6e\u597d\u60a8\u7684\u8f93\u5165\u6587\u4ef6\u540e\uff0c\u60a8\u5c06\u4f7f\u7528\u51e0\u4e2a\u4e0d\u540c\u7684\u8fc7\u6ee4\u5668\u6765\u64cd\u4f5c\u6570\u636e\uff0c\u4ee5\u8ba1\u7b97\u51fa\u6240\u6709\u4e09\u4e2a\u5c5e\u6027\u7684\u503c\uff1acreatures\u3001totalClams\u548ctotalDolphinClams\u3002\u5728\u4e0b\u4e00\u6b65\u4e2d\uff0c\u60a8\u5c06\u627e\u5230creatures\u503c\u7684\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<h2>\u6b65\u9aa42 \u2014 \u83b7\u53d6\u751f\u7269\u7684\u4ef7\u503c<\/h2>\n<p>\u5728\u8fd9\u4e00\u6b65\u9aa4\u4e2d\uff0c\u60a8\u5c06\u751f\u6210\u4e00\u4e2a\u5305\u542b\u6240\u6709\u6d77\u6d0b\u751f\u7269\u7684\u5217\u8868\uff0c\u5229\u7528\u751f\u7269\u7684\u503c\u6765\u627e\u5230\u5b83\u4eec\u7684\u540d\u79f0\u3002\u5728\u5b8c\u6210\u8fd9\u4e00\u6b65\u9aa4\u540e\uff0c\u60a8\u5c06\u751f\u6210\u4ee5\u4e0b\u540d\u79f0\u7684\u5217\u8868\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ &#8220;Sammy&#8221;, &#8220;Bubbles&#8221;, &#8220;Splish&#8221;, &#8220;Splash&#8221; ],<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u751f\u6210\u6b64\u5217\u8868\u9700\u8981\u63d0\u53d6\u751f\u7269\u540d\u79f0\uff0c\u7136\u540e\u5c06\u5176\u5408\u5e76\u5230\u4e00\u4e2a\u6570\u7ec4\u4e2d\u3002<\/p>\n<p>\u4f60\u9700\u8981\u6539\u8fdb\u4f60\u7684\u8fc7\u6ee4\u5668\uff0c\u4ee5\u4fbf\u83b7\u53d6\u6240\u6709\u751f\u7269\u7684\u540d\u79f0\u5e76\u4e22\u5f03\u5176\u4ed6\u6240\u6709\u5185\u5bb9\u3002\u7531\u4e8e\u4f60\u5728\u5904\u7406\u6570\u7ec4\uff0c\u4f60\u9700\u8981\u544a\u8bc9 jq \u4f60\u5e0c\u671b\u64cd\u4f5c\u7684\u662f\u8be5\u6570\u7ec4\u7684\u503c\uff0c\u800c\u4e0d\u662f\u6570\u7ec4\u672c\u8eab\u3002\u6570\u7ec4\u503c\u8fed\u4ee3\u5668\u5199\u4f5c .[]\uff0c\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e2a\u76ee\u7684\u3002<\/p>\n<p>\u4f7f\u7528\u4fee\u6539\u540e\u7684\u8fc7\u6ee4\u5668\u8fd0\u884cjq\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;.[]&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u6bcf\u4e2a\u6570\u7ec4\u503c\u90fd\u5355\u72ec\u8f93\u51fa\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>{ &#8220;name&#8221;: &#8220;Sammy&#8221;, &#8220;type&#8221;: &#8220;shark&#8221;, &#8220;clams&#8221;: 5 } { &#8220;name&#8221;: &#8220;Bubbles&#8221;, &#8220;type&#8221;: &#8220;orca&#8221;, &#8220;clams&#8221;: 3 } { &#8220;name&#8221;: &#8220;Splish&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 } { &#8220;name&#8221;: &#8220;Splash&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4e0d\u5fc5\u8f93\u51fa\u6bcf\u4e2a\u6570\u7ec4\u9879\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u800c\u662f\u53ea\u9700\u8f93\u51fa\u540d\u5b57\u5c5e\u6027\u7684\u503c\u5e76\u4e22\u5f03\u5176\u5b83\u5185\u5bb9\u3002\u7ba1\u9053\u64cd\u4f5c\u7b26\u201c|\u201d\u53ef\u4ee5\u8ba9\u4f60\u5bf9\u6bcf\u4e2a\u8f93\u51fa\u5e94\u7528\u4e00\u4e2a\u8fc7\u6ee4\u5668\u3002\u5982\u679c\u4f60\u5728\u547d\u4ee4\u884c\u4e0a\u4f7f\u7528\u4e86find | xargs\u547d\u4ee4\u6765\u5bf9\u6bcf\u4e2a\u641c\u7d22\u7ed3\u679c\u5e94\u7528\u4e00\u4e2a\u547d\u4ee4\uff0c\u90a3\u4e48\u8fd9\u79cd\u6a21\u5f0f\u4f1a\u611f\u5230\u5f88\u719f\u6089\u3002<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528 .name\uff0c\u53ef\u4ee5\u8bbf\u95eeJSON\u5bf9\u8c61\u7684\u540d\u79f0\u5c5e\u6027\u3002\u5c06\u7ba1\u9053\u4e0e\u8fc7\u6ee4\u5668\u7ed3\u5408\uff0c\u5e76\u5728 seaCreatures.json \u4e0a\u8fd0\u884c\u6b64\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;.[] <mark>| .name<\/mark>&#8216;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f60\u4f1a\u6ce8\u610f\u5230\u8f93\u51fa\u4e2d\u5176\u4ed6\u7684\u5c5e\u6027\u5df2\u7ecf\u6d88\u5931\u4e86\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&#8220;Sammy&#8221; &#8220;Bubbles&#8221; &#8220;Splish&#8221; &#8220;Splash&#8221;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cjq\u8f93\u51fa\u6709\u6548\u7684JSON\uff0c\u56e0\u6b64\u5b57\u7b26\u4e32\u5c06\u51fa\u73b0\u5728\u53cc\u5f15\u53f7(&#8220;&#8221;)\u4e2d\u3002\u5982\u679c\u4f60\u9700\u8981\u4e00\u4e2a\u6ca1\u6709\u53cc\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u52a0\u4e0a-r\u6807\u5fd7\u6765\u542f\u7528\u539f\u59cb\u8f93\u51fa\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token parameter variable\">-r<\/span> <span class=\"token string\">&#8216;.[] | .name&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5f15\u53f7\u6d88\u5931\u4e86\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>Sammy Bubbles Splish Splash<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f60\u73b0\u5728\u77e5\u9053\u5982\u4f55\u4eceJSON\u8f93\u5165\u4e2d\u63d0\u53d6\u7279\u5b9a\u4fe1\u606f\u3002\u4f60\u5c06\u4f7f\u7528\u8fd9\u79cd\u6280\u672f\u6765\u5728\u4e0b\u4e00\u6b65\u4e2d\u627e\u5230\u5176\u4ed6\u7279\u5b9a\u4fe1\u606f\uff0c\u7136\u540e\u5728\u6700\u540e\u4e00\u6b65\u4e2d\u751f\u6210&#8221;creatures&#8221;\u503c\u3002<\/p>\n<h2>\u7b2c\u4e09\u6b65\u2014\u4f7f\u7528map\u548cadd\u8ba1\u7b97totalClams\u7684\u503c<\/h2>\n<p>\u5728\u8fd9\u4e00\u6b65\u4e2d\uff0c\u4f60\u5c06\u627e\u5230\u8fd9\u4e9b\u751f\u7269\u62e5\u6709\u591a\u5c11\u86e4\u870a\u7684\u603b\u4fe1\u606f\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u805a\u5408\u4e00\u4e9b\u6570\u636e\u6765\u8ba1\u7b97\u7b54\u6848\u3002\u4e00\u65e6\u4f60\u719f\u6089jq\uff0c\u8fd9\u5c06\u6bd4\u624b\u52a8\u8ba1\u7b97\u66f4\u5feb\uff0c\u800c\u4e14\u66f4\u4e0d\u5bb9\u6613\u51fa\u73b0\u4eba\u4e3a\u9519\u8bef\u3002\u5728\u8fd9\u4e00\u6b65\u9aa4\u7ed3\u675f\u65f6\uff0c\u9884\u671f\u503c\u4e3a12\u3002<\/p>\n<p>\u5728\u6b65\u9aa42\u4e2d\uff0c\u60a8\u4ece\u9879\u76ee\u5217\u8868\u4e2d\u63d0\u53d6\u4e86\u7279\u5b9a\u7684\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u91cd\u590d\u4f7f\u7528\u8fd9\u79cd\u6280\u672f\u6765\u63d0\u53d6\u86e4\u870a\u5c5e\u6027\u7684\u503c\u3002\u8c03\u6574\u8fd9\u4e2a\u65b0\u5c5e\u6027\u7684\u8fc7\u6ee4\u5668\uff0c\u5e76\u8fd0\u884c\u547d\u4ee4\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;.[] | .<mark>clams<\/mark>&#8216;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f1a\u8f93\u51fa\u86e4\u870a\u5c5e\u6027\u7684\u5404\u4e2a\u503c\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>5 3 2 2<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4e3a\u4e86\u5f97\u5230\u6bcf\u4e2a\u503c\u7684\u603b\u548c\uff0c\u4f60\u9700\u8981\u4f7f\u7528\u6dfb\u52a0\u8fc7\u6ee4\u5668\u3002\u6dfb\u52a0\u8fc7\u6ee4\u5668\u9002\u7528\u4e8e\u6570\u7ec4\u3002\u7136\u800c\uff0c\u4f60\u76ee\u524d\u8f93\u51fa\u7684\u662f\u6570\u7ec4\u503c\uff0c\u6240\u4ee5\u4f60\u5fc5\u987b\u5148\u5c06\u5b83\u4eec\u5305\u88c5\u5728\u4e00\u4e2a\u6570\u7ec4\u4e2d\u3002<\/p>\n<p>\u5c06\u73b0\u6709\u7684\u7b5b\u9009\u5668\u7528[]\u5305\u56f4\u8d77\u6765\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;<mark>[<\/mark>.[] | .clams<mark>]<\/mark>&#8216;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8fd9\u4e9b\u503c\u5c06\u4f1a\u4ee5\u5217\u8868\u7684\u5f62\u5f0f\u5448\u73b0\u51fa\u6765\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ 5, 3, 2, 2 ]<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5728\u5e94\u7528\u6dfb\u52a0\u8fc7\u6ee4\u5668\u4e4b\u524d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528map\u51fd\u6570\u6765\u63d0\u9ad8\u547d\u4ee4\u7684\u53ef\u8bfb\u6027\uff0c\u8fd9\u4e5f\u4f7f\u5f97\u547d\u4ee4\u66f4\u6613\u4e8e\u7ef4\u62a4\u3002\u901a\u8fc7\u4e00\u6b21map\u8c03\u7528\uff0c\u4f60\u53ef\u4ee5\u5728\u5faa\u73af\u6570\u7ec4\u7684\u8fc7\u7a0b\u4e2d\u5bf9\u6bcf\u4e2a\u9879\u5e94\u7528\u8fc7\u6ee4\u5668\uff0c\u7136\u540e\u5c06\u7ed3\u679c\u5305\u88c5\u5728\u4e00\u4e2a\u6570\u7ec4\u4e2d\u3002\u7ed9\u5b9a\u4e00\u4e2a\u9879\u7684\u6570\u7ec4\uff0cmap\u51fd\u6570\u5c06\u5176\u53c2\u6570\u4f5c\u4e3a\u8fc7\u6ee4\u5668\u5e94\u7528\u5230\u6bcf\u4e2a\u9879\u4e0a\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5c06\u8fc7\u6ee4\u5668map(.name)\u5e94\u7528\u5230[{&#8220;name&#8221;: &#8220;Sammy&#8221;}, {&#8220;name&#8221;: &#8220;Bubbles&#8221;}]\uff0c\u90a3\u4e48\u751f\u6210\u7684JSON\u5bf9\u8c61\u5c06\u662f[&#8220;Sammy&#8221;, &#8220;Bubbles&#8221;]\u3002<\/p>\n<p>\u5c06\u8fc7\u6ee4\u5668\u91cd\u5199\u4e3a\u751f\u6210\u4e00\u4e2a\u6570\u7ec4\uff0c\u4f7f\u7528\u6620\u5c04\u51fd\u6570\u4ee3\u66ff\uff0c\u7136\u540e\u8fd0\u884c\u5b83\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;map(.clams)&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f60\u5c06\u4f1a\u5f97\u5230\u548c\u4e4b\u524d\u4e00\u6837\u7684\u8f93\u51fa\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ 5, 3, 2, 2 ]<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u65e2\u7136\u4f60\u73b0\u5728\u62e5\u6709\u4e00\u4e2a\u6570\u7ec4\uff0c\u4f60\u53ef\u4ee5\u5c06\u5b83\u4f20\u9012\u5230\u6dfb\u52a0\u8fc7\u6ee4\u5668\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;map(.clams) <mark>| add<\/mark>&#8216;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u5c06\u6536\u5230\u6570\u7ec4\u7684\u603b\u548c\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>12<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u901a\u8fc7\u8fd9\u4e2a\u7b5b\u9009\u5668\uff0c\u60a8\u5df2\u7ecf\u8ba1\u7b97\u51fa\u4e86\u86e4\u870a\u7684\u603b\u6570\u91cf\uff0c\u60a8\u5c06\u5728\u4ee5\u540e\u4f7f\u7528\u8fd9\u4e2a\u8ba1\u7b97\u7ed3\u679c\u751f\u6210totalClams\u7684\u503c\u3002\u60a8\u5df2\u7ecf\u7f16\u5199\u4e86\u4e24\u4e2a\u95ee\u9898\u7684\u8fc7\u6ee4\u5668\u3002\u60a8\u8fd8\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u8fc7\u6ee4\u5668\uff0c\u7136\u540e\u60a8\u5c31\u53ef\u4ee5\u751f\u6210\u6700\u7ec8\u7684\u8f93\u51fa\u3002<\/p>\n<h2>\u7b2c\u56db\u6b65 &#8211; \u4f7f\u7528add\u8fc7\u6ee4\u5668\u8ba1\u7b97\u603b\u7684\u6d77\u8c5a\u86e4\u870a\u4ef7\u503c<\/h2>\n<p>\u73b0\u5728\u4f60\u77e5\u9053\u4e86\u8fd9\u4e9b\u751f\u7269\u62e5\u6709\u591a\u5c11\u8d1d\u58f3\uff0c\u4f60\u53ef\u4ee5\u786e\u5b9a\u6d77\u8c5a\u62e5\u6709\u5176\u4e2d\u591a\u5c11\u8d1d\u58f3\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5c06\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u6570\u7ec4\u5143\u7d20\u7684\u503c\u76f8\u52a0\u6765\u5f97\u51fa\u7b54\u6848\u3002\u5728\u8fd9\u4e00\u6b65\u9aa4\u7ed3\u675f\u65f6\uff0c\u9884\u671f\u7684\u503c\u662f4\uff0c\u8fd9\u662f\u6d77\u8c5a\u62e5\u6709\u7684\u8d1d\u58f3\u603b\u6570\u3002\u5728\u6700\u540e\u4e00\u6b65\u4e2d\uff0c\u6240\u5f97\u5230\u7684\u503c\u5c06\u88ab\u7528\u4e8etotalDolphinClams\u5c5e\u6027\u3002<\/p>\n<p>\u4e0e\u5176\u50cf\u4f60\u5728\u6b65\u9aa43\u4e2d\u90a3\u6837\u6dfb\u52a0\u6240\u6709\u86e4\u870a\u503c\uff0c\u4f60\u53ea\u4f1a\u8ba1\u7b97\u7531\u5177\u6709\u201c\u6d77\u8c5a\u201d\u7c7b\u578b\u7684\u751f\u7269\u6240\u6301\u6709\u7684\u86e4\u870a\u3002\u4f60\u5c06\u4f7f\u7528select\u51fd\u6570\u6765\u9009\u62e9\u7279\u5b9a\u6761\u4ef6\uff1aselect(condition)\u3002\u6240\u6709\u6ee1\u8db3\u6761\u4ef6\u7684\u8f93\u5165\u5c06\u88ab\u4f20\u9012\u4e0b\u53bb\uff0c\u800c\u5176\u4ed6\u6240\u6709\u8f93\u5165\u5c06\u88ab\u4e22\u5f03\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u7684JSON\u8f93\u5165\u662f\u201c\u6d77\u8c5a\u201d\uff0c\u4f60\u7684\u8fc7\u6ee4\u5668\u662fselect(. == &#8220;\u6d77\u8c5a&#8221;\uff09\uff0c\u8f93\u51fa\u5c06\u662f\u201c\u6d77\u8c5a\u201d\u3002\u5bf9\u4e8e\u8f93\u5165\u201cSammy\u201d\uff0c\u76f8\u540c\u7684\u8fc7\u6ee4\u5668\u5c06\u4e0d\u4ea7\u751f\u4efb\u4f55\u8f93\u51fa\u3002<\/p>\n<p>\u8981\u5bf9\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u503c\u5e94\u7528\u9009\u62e9\uff0c\u53ef\u4ee5\u5c06\u5176\u4e0e\u6620\u5c04\u51fd\u6570\u914d\u5bf9\u4f7f\u7528\u3002\u901a\u8fc7\u8fd9\u6837\u505a\uff0c\u4e0d\u6ee1\u8db3\u6761\u4ef6\u7684\u6570\u7ec4\u503c\u5c06\u88ab\u4e22\u5f03\u3002<\/p>\n<p>\u5728\u4f60\u7684\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ea\u60f3\u4fdd\u7559\u7c7b\u578b\u503c\u7b49\u4e8e&#8221;\u6d77\u8c5a&#8221;\u7684\u6570\u7ec4\u503c\u3002\u7ed3\u679c\u8fc7\u6ee4\u5668\u4e3a\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;map(<mark>select(.type == &#8220;dolphin&#8221;)<\/mark>)&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f60\u7684\u8fc7\u6ee4\u5668\u5c06\u65e0\u6cd5\u5339\u914d\u5230\u9ca8\u9c7c\u5c71\u7c73\u548c\u864e\u9cb8\u5df4\u5e03\u5c14\uff0c\u4f46\u5b83\u80fd\u5339\u914d\u5230\u90a3\u4e24\u53ea\u6d77\u8c5a\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ { &#8220;name&#8221;: &#8220;Splish&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 }, { &#8220;name&#8221;: &#8220;Splash&#8221;, &#8220;type&#8221;: &#8220;dolphin&#8221;, &#8220;clams&#8221;: 2 } ]<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8fd9\u4e2a\u8f93\u51fa\u5305\u542b\u6bcf\u4e2a\u751f\u7269\u7684\u86e4\u870a\u6570\u91cf\uff0c\u4ee5\u53ca\u4e00\u4e9b\u4e0d\u76f8\u5173\u7684\u4fe1\u606f\u3002\u4e3a\u4e86\u4ec5\u4fdd\u7559\u86e4\u870a\u7684\u503c\uff0c\u60a8\u53ef\u4ee5\u5c06\u5b57\u6bb5\u7684\u540d\u79f0\u8ffd\u52a0\u5230\u6620\u5c04\u53c2\u6570\u7684\u672b\u5c3e\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;map(select(.type == &#8220;dolphin&#8221;)<mark>.clams<\/mark>)&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5730\u56fe\u51fd\u6570\u63a5\u6536\u4e00\u4e2a\u6570\u7ec4\u4f5c\u4e3a\u8f93\u5165\uff0c\u5e76\u5c06map\u7684\u7b5b\u9009\u6761\u4ef6\uff08\u4f5c\u4e3a\u53c2\u6570\uff09\u5e94\u7528\u4e8e\u6bcf\u4e2a\u6570\u7ec4\u5143\u7d20\u3002\u7ed3\u679c\u662f\uff0cselect\u88ab\u8c03\u7528\u4e86\u56db\u6b21\uff0c\u6bcf\u4e2a\u751f\u7269\u90fd\u8c03\u7528\u4e86\u4e00\u6b21\u3002select\u51fd\u6570\u5c06\u4e3a\u4e24\u53ea\u6d77\u8c5a\u751f\u6210\u8f93\u51fa\uff08\u56e0\u4e3a\u5b83\u4eec\u7b26\u5408\u6761\u4ef6\uff09\uff0c\u5e76\u7701\u7565\u5176\u4ed6\u7684\u751f\u7269\u3002<\/p>\n<p>\u60a8\u7684\u8f93\u51fa\u5c06\u662f\u4e00\u4e2a\u53ea\u5305\u542b\u4e24\u4e2a\u5339\u914d\u751f\u7269\u7684\u8d1d\u58f3\u503c\u7684\u6570\u7ec4\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>[ 2, 2 ]<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u5c06\u6570\u7ec4\u503c\u8f93\u5165\u5230add\u51fd\u6570\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;map(select(.type == &#8220;dolphin&#8221;).clams) <mark>| add<\/mark>&#8216;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u60a8\u7684\u8f93\u51fa\u5c06\u8fd4\u56de\u201c\u6d77\u8c5a\u201d\u7c7b\u578b\u751f\u7269\u7684\u86e4\u870a\u4ef7\u503c\u4e4b\u548c\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>4<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f60\u5df2\u6210\u529f\u5730\u5c06map\u548cselect\u7ed3\u5408\u8d77\u6765\u8bbf\u95ee\u4e00\u4e2a\u6570\u7ec4\uff0c\u9009\u62e9\u6ee1\u8db3\u6761\u4ef6\u7684\u6570\u7ec4\u9879\uff0c\u5bf9\u5b83\u4eec\u8fdb\u884c\u8f6c\u6362\u5e76\u6c47\u603b\u8f6c\u6362\u7684\u7ed3\u679c\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u7b56\u7565\u6765\u8ba1\u7b97\u6700\u7ec8\u8f93\u51fa\u4e2d\u7684totalDolphinClams\uff0c\u5728\u4e0b\u4e00\u6b65\u4e2d\u4f60\u5c06\u8fd9\u6837\u505a\u3002<\/p>\n<h2>\u6b65\u9aa45 &#8211; \u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u65b0\u7684\u6570\u636e\u7ed3\u6784<\/h2>\n<p>\u5728\u4e4b\u524d\u7684\u6b65\u9aa4\u4e2d\uff0c\u4f60\u7f16\u5199\u4e86\u4e00\u4e9b\u8fc7\u6ee4\u5668\u6765\u63d0\u53d6\u548c\u5904\u7406\u6837\u672c\u6570\u636e\u3002\u73b0\u5728\uff0c\u4f60\u53ef\u4ee5\u5c06\u8fd9\u4e9b\u8fc7\u6ee4\u5668\u7ed3\u5408\u8d77\u6765\u751f\u6210\u4e00\u4e2a\u8f93\u51fa\uff0c\u4ee5\u56de\u7b54\u4f60\u5bf9\u4e8e\u6570\u636e\u7684\u95ee\u9898\u3002<\/p>\n<ul class=\"post-ul\">\n<li>What are the names of the sea creatures in list form?<\/li>\n<li>How many clams do the creatures own in total?<\/li>\n<li>How many of those clams are owned by dolphins?<\/li>\n<\/ul>\n<p>\u4e3a\u4e86\u4ee5\u5217\u8868\u5f62\u5f0f\u627e\u51fa\u6d77\u6d0b\u751f\u7269\u7684\u540d\u79f0\uff0c\u60a8\u4f7f\u7528\u4e86map\u51fd\u6570\uff1amap(.name)\u3002\u4e3a\u4e86\u627e\u51fa\u8fd9\u4e9b\u751f\u7269\u62e5\u6709\u591a\u5c11\u8d1d\u58f3\uff0c\u60a8\u5c06\u6240\u6709\u7684\u8d1d\u58f3\u503c\u5bfc\u5165\u4e86add\u8fc7\u6ee4\u5668\uff1amap(.clams) | add\u3002\u4e3a\u4e86\u627e\u51fa\u5176\u4e2d\u6709\u591a\u5c11\u8d1d\u58f3\u662f\u7531\u6d77\u8c5a\u62e5\u6709\u7684\uff0c\u60a8\u4f7f\u7528\u4e86select\u51fd\u6570\uff0c\u5e76\u52a0\u4e0a\u4e86.type == &#8220;dolphin&#8221;\u7684\u6761\u4ef6\uff1amap(select(.type == &#8220;dolphin&#8221;).clams) | add\u3002<\/p>\n<p>\u60a8\u5c06\u628a\u8fd9\u4e9b\u8fc7\u6ee4\u5668\u5408\u5e76\u5728\u4e00\u4e2ajq\u547d\u4ee4\u4e2d\u5b8c\u6210\u6240\u6709\u64cd\u4f5c\u3002\u60a8\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684JSON\u5bf9\u8c61\uff0c\u5408\u5e76\u8fd9\u4e09\u4e2a\u8fc7\u6ee4\u5668\uff0c\u4ee5\u521b\u5efa\u4e00\u4e2a\u663e\u793a\u6240\u9700\u4fe1\u606f\u7684\u65b0\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<p>\u63d0\u9192\u4e00\u4e0b\uff0c\u4f60\u7684\u521d\u59cbJSON\u6587\u4ef6\u4e0e\u4ee5\u4e0b\u5185\u5bb9\u76f8\u5339\u914d\uff1a<\/p>\n<div>\u6d77\u6d0b\u751f\u7269.json<\/div>\n<pre class=\"post-pre\"><code>[\r\n    { \"name\": \"Sammy\", \"type\": \"shark\", \"clams\": 5 },\r\n    { \"name\": \"Bubbles\", \"type\": \"orca\", \"clams\": 3 },\r\n    { \"name\": \"Splish\", \"type\": \"dolphin\", \"clams\": 2 },\r\n    { \"name\": \"Splash\", \"type\": \"dolphin\", \"clams\": 2 }\r\n]\r\n<\/code><\/pre>\n<p>\u60a8\u8f6c\u6362\u7684JSON\u8f93\u51fa\u4f1a\u751f\u6210\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Final Output\">Final Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>{ &#8220;creatures&#8221;: [ &#8220;Sammy&#8221;, &#8220;Bubbles&#8221;, &#8220;Splish&#8221;, &#8220;Splash&#8221; ], &#8220;totalClams&#8221;: 12, &#8220;totalDolphinClams&#8221;: 4 }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0b\u662f\u4f7f\u7528\u7a7a\u8f93\u5165\u503c\u8fdb\u884c\u5b8c\u6574jq\u547d\u4ee4\u8bed\u6cd5\u7684\u6f14\u793a\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;{ creatures: <mark>[]<\/mark>, totalClams: <mark>0<\/mark>, totalDolphinClams: <mark>0<\/mark> }&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4f7f\u7528\u6b64\u7b5b\u9009\u5668\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e09\u4e2a\u5c5e\u6027\u7684JSON\u5bf9\u8c61\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>{ &#8220;creatures&#8221;: <mark>[]<\/mark>, &#8220;totalClams&#8221;: <mark>0<\/mark>, &#8220;totalDolphinClams&#8221;: <mark>0<\/mark> }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u8fd9\u770b\u8d77\u6765\u50cf\u6700\u7ec8\u7684\u8f93\u51fa\uff0c\u4f46\u8f93\u5165\u503c\u4e0d\u6b63\u786e\uff0c\u56e0\u4e3a\u5b83\u4eec\u5c1a\u672a\u4ece\u60a8\u7684seaCreatures.json\u6587\u4ef6\u4e2d\u63d0\u53d6\u3002<\/p>\n<p>\u5c06\u786c\u7f16\u7801\u7684\u5c5e\u6027\u503c\u66ff\u6362\u4e3a\u60a8\u5728\u6bcf\u4e2a\u4e4b\u524d\u6b65\u9aa4\u4e2d\u521b\u5efa\u7684\u8fc7\u6ee4\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<ol>\n<li data-prefix=\"$\">jq <span class=\"token string\">&#8216;{ creatures: <mark>map(.name)<\/mark>, totalClams: <mark>map(.clams) | add<\/mark>, totalDolphinClams: <mark>map(select(.type == &#8220;dolphin&#8221;).clams) | add<\/mark> }&#8217;<\/span> seaCreatures.json<\/li>\n<\/ol>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u4ee5\u4e0a\u7684\u8fc7\u6ee4\u5668\u544a\u8bc9 jq \u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\u7684 JSON \u5bf9\u8c61\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>A creatures attribute containing a list of every creature\u2019s name value.<\/li>\n<li>A totalClams attribute containing a sum of every creature\u2019s clams value.<\/li>\n<li>A totalDolphinClams attribute containing a sum of every creature\u2019s clams value for which type equals &#8220;dolphin&#8221;.<\/li>\n<\/ul>\n<p>\u8fd0\u884c\u8be5\u547d\u4ee4\uff0c\u8be5\u7b5b\u9009\u5668\u7684\u8f93\u51fa\u5e94\u8be5\u662f\uff1a<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<div class=\"secondary-code-label\" title=\"Output\">Output<\/div>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>{ &#8220;creatures&#8221;: [ &#8220;Sammy&#8221;, &#8220;Bubbles&#8221;, &#8220;Splish&#8221;, &#8220;Splash&#8221; ], &#8220;totalClams&#8221;: 12, &#8220;totalDolphinClams&#8221;: 4 }<\/p>\n<pre class=\"post-pre\"><code><\/code><\/pre>\n<p>\u73b0\u5728\u60a8\u6709\u4e00\u4e2a\u5305\u542b\u6240\u6709\u4e09\u4e2a\u95ee\u9898\u76f8\u5173\u6570\u636e\u7684\u5355\u4e2aJSON\u5bf9\u8c61\u3002\u5982\u679c\u6570\u636e\u96c6\u53d1\u751f\u53d8\u5316\uff0c\u60a8\u7f16\u5199\u7684jq\u8fc7\u6ee4\u5668\u5c06\u5141\u8bb8\u60a8\u968f\u65f6\u91cd\u65b0\u5e94\u7528\u8f6c\u6362\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u5f53\u4f7f\u7528JSON\u8f93\u5165\u65f6\uff0cjq\u53ef\u4ee5\u5e2e\u52a9\u60a8\u6267\u884c\u8bb8\u591a\u5728sed\u7b49\u6587\u672c\u64cd\u4f5c\u5de5\u5177\u4e2d\u5f88\u96be\u5b9e\u73b0\u7684\u6570\u636e\u8f6c\u6362\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528select\u51fd\u6570\u7b5b\u9009\u6570\u636e\uff0c\u4f7f\u7528map\u51fd\u6570\u8f6c\u6362\u6570\u7ec4\u5143\u7d20\uff0c\u4f7f\u7528add\u8fc7\u6ee4\u5668\u5bf9\u6570\u5b57\u6570\u7ec4\u8fdb\u884c\u6c42\u548c\uff0c\u5e76\u5b66\u4f1a\u5982\u4f55\u5c06\u8f6c\u6362\u5408\u5e76\u6210\u65b0\u7684\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<p>\u8981\u4e86\u89e3jq\u9ad8\u7ea7\u529f\u80fd\uff0c\u8bf7\u6d4f\u89c8jq\u53c2\u8003\u6587\u6863\u3002\u5982\u679c\u60a8\u7ecf\u5e38\u4f7f\u7528\u975eJSON\u547d\u4ee4\u8f93\u51fa\uff0c\u60a8\u53ef\u4ee5\u67e5\u9605\u6211\u4eec\u7684sed\u3001awk\u6216grep\u6307\u5357\uff0c\u4e86\u89e3\u9002\u7528\u4e8e\u4efb\u610f\u683c\u5f0f\u7684\u6587\u672c\u5904\u7406\u6280\u5de7\u7684\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb \u5728\u5904\u7406\u5927\u578bJSON\u6587\u4ef6\u65f6\uff0c\u5f88\u96be\u627e\u5230\u548c\u64cd\u4f5c\u6240\u9700\u7684\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u590d\u5236\u548c\u7c98\u8d34\u6240\u6709\u76f8\u5173\u7247\u6bb5\u624b\u52a8\u8ba1\u7b97\u603b\u6570\uff0c\u4f46\u8fd9\u662f\u4e00\u4e2a [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-50714","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362json\u6570\u636e\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e\" \/>\n<meta property=\"og:description\" content=\"\u7b80\u4ecb \u5728\u5904\u7406\u5927\u578bJSON\u6587\u4ef6\u65f6\uff0c\u5f88\u96be\u627e\u5230\u548c\u64cd\u4f5c\u6240\u9700\u7684\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u590d\u5236\u548c\u7c98\u8d34\u6240\u6709\u76f8\u5173\u7247\u6bb5\u624b\u52a8\u8ba1\u7b97\u603b\u6570\uff0c\u4f46\u8fd9\u662f\u4e00\u4e2a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362json\u6570\u636e\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-09T23:45:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T05:17:17+00:00\" \/>\n<meta name=\"author\" content=\"\u9038, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u9038, \u79d1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/\",\"name\":\"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-04-09T23:45:06+00:00\",\"dateModified\":\"2024-01-15T05:17:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\",\"name\":\"\u9038, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"caption\":\"\u9038, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362json\u6570\u636e\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e","og_description":"\u7b80\u4ecb \u5728\u5904\u7406\u5927\u578bJSON\u6587\u4ef6\u65f6\uff0c\u5f88\u96be\u627e\u5230\u548c\u64cd\u4f5c\u6240\u9700\u7684\u4fe1\u606f\u3002\u60a8\u53ef\u4ee5\u590d\u5236\u548c\u7c98\u8d34\u6240\u6709\u76f8\u5173\u7247\u6bb5\u624b\u52a8\u8ba1\u7b97\u603b\u6570\uff0c\u4f46\u8fd9\u662f\u4e00\u4e2a [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362json\u6570\u636e\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-04-09T23:45:06+00:00","article_modified_time":"2024-01-15T05:17:17+00:00","author":"\u9038, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u9038, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/","name":"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-04-09T23:45:06+00:00","dateModified":"2024-01-15T05:17:17+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u4f7f\u7528jq\u8f6c\u6362JSON\u6570\u636e"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487","name":"\u9038, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","caption":"\u9038, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8jq%e8%bd%ac%e6%8d%a2json%e6%95%b0%e6%8d%ae\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=50714"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50714\/revisions"}],"predecessor-version":[{"id":59808,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50714\/revisions\/59808"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=50714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=50714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=50714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}