{"id":53239,"date":"2024-12-03T17:12:19","date_gmt":"2024-12-03T09:12:19","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53239\/"},"modified":"2024-12-03T17:12:19","modified_gmt":"2024-12-03T09:12:19","slug":"%e5%a6%82%e4%bd%95%e4%b8%ba-json-%e6%95%b0%e6%8d%ae%e6%b7%bb%e5%8a%a0%e9%80%92%e5%a2%9e%e5%ba%8f%e5%8f%b7%e5%ad%97%e6%ae%b5%ef%bc%9f-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53239\/","title":{"rendered":"\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241128\/17327707536747fbc197bb6.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4e3a json \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5<\/strong><\/p>\n<p>\u8981\u4e3a json \u6570\u636e\u6dfb\u52a0\u4e00\u4e2a\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u53d1\u9001 ajax \u8bf7\u6c42\u83b7\u53d6 json \u6570\u636e\u3002<\/li>\n<\/ol>\n<pre>var json = $.ajax({\n  type: \"get\",\n  url: \"url.url\",\n  success: function(result) {\n    \/\/ ...\n  }\n});<\/pre>\n<ol>\n<li>\u4f7f\u7528 jquery.parsejson \u5c06 json \u6570\u636e\u8f6c\u6362\u6210 javascript \u5bf9\u8c61\u3002<\/li>\n<\/ol>\n<pre>var json = jquery.parsejson(osettings.jqxhr.responsetext);<\/pre>\n<ol>\n<li>\u6dfb\u52a0\u4e00\u4e2a\u5e8f\u53f7\u5b57\u6bb5\u56de\u8c03\u51fd\u6570\u3002<\/li>\n<\/ol>\n<pre>var opt = {\n  \"fndrawcallback\": function(osettings) {\n    \/\/ ...\n  }\n};<\/pre>\n<ol>\n<li>\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u4f7f\u7528 datatables api \u83b7\u53d6\u6570\u636e\u5e76\u6dfb\u52a0\u5e8f\u53f7\u5b57\u6bb5\u3002<\/li>\n<\/ol>\n<pre>var api = this.api();\nvar startIndex = api.context[0]._iDisplayStart;\napi.column(0).nodes().each(function(cell, i) {\n  cell.innerHTML = startIndex + i + 1;\n});<\/pre>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   win11\u600e\u4e48\u66f4\u6362\u5f00\u673a\u63d0\u793a\u8bed win11\u5f00\u673a\u63d0\u793a\u8bed\u66f4\u6362\u6559\u7a0b\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f \u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u5982\u4f55\u4e3a JSON \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002 \u5982\u4f55\u4e3a json \u6570\u636e\u6dfb\u52a0\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5 \u8981\u4e3a json \u6570\u636e\u6dfb\u52a0\u4e00\u4e2a\u9012\u589e\u5e8f\u53f7\u5b57\u6bb5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a \u53d1\u9001 ajax \u8bf7\u6c42\u83b7\u53d6 json \u6570\u636e\u3002 var json = $.ajax({ type: &#8220;get&#8221;, url: &#8220;url.url&#8221;, success: function(result) { \/\/ &#8230; } }); \u4f7f\u7528 jquery.parsejson \u5c06 json \u6570\u636e\u8f6c\u6362\u6210 javascript \u5bf9\u8c61\u3002 var json = jquery.parsejson(osettings.jqxhr.responsetext); \u6dfb\u52a0\u4e00\u4e2a\u5e8f\u53f7\u5b57\u6bb5\u56de\u8c03\u51fd\u6570\u3002 var opt = { &#8220;fndrawcallback&#8221;: function(osettings) { \/\/ &#8230; } }; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53239","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53239"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53239\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}