{"id":46729,"date":"2024-06-09T14:38:07","date_gmt":"2024-06-09T06:38:07","guid":{"rendered":"http:\/\/www.biocloudservice.com\/wordpress\/?p=46729"},"modified":"2024-06-09T14:38:07","modified_gmt":"2024-06-09T06:38:07","slug":"json%e6%a0%bc%e5%bc%8f%e4%bb%80%e4%b9%88%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/www.biocloudservice.com\/wordpress\/?p=46729","title":{"rendered":"JSON\u683c\u5f0f\u4ec0\u4e48\uff1f"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>JSON\uff08JavaScript Object Notation\uff0cJavaScript \u5bf9\u8c61\u8868\u793a\u6cd5\uff09\u662f\u4e00\u79cd\u8f7b\u91cf\u7ea7\u7684\u6570\u636e\u4ea4\u6362\u683c\u5f0f\uff0c\u6613\u4e8e\u4eba\u9605\u8bfb\u548c\u7f16\u5199\uff0c\u540c\u65f6\u4e5f\u6613\u4e8e\u673a\u5668\u89e3\u6790\u548c\u751f\u6210\u3002\u5b83\u57fa\u4e8e JavaScript \u8bed\u8a00\u7684\u4e00\u4e2a\u5b50\u96c6\uff0c\u4f46\u662f\u5b83\u662f\u8bed\u8a00\u65e0\u5173\u7684\uff0c\u5f88\u591a\u7f16\u7a0b\u8bed\u8a00\u90fd\u652f\u6301 JSON\u3002\n\nJSON \u6570\u636e\u683c\u5f0f\u7684\u4e3b\u8981\u7279\u70b9\u5305\u62ec\uff1a\n\n1. **\u952e\u503c\u5bf9**\uff1aJSON \u7531\u4e00\u7cfb\u5217\u952e\u503c\u5bf9\u7ec4\u6210\uff0c\u952e\u548c\u503c\u4e4b\u95f4\u7528\u5192\u53f7 `:` \u5206\u9694\u3002\n2. **\u6570\u7ec4**\uff1a\u591a\u4e2a\u503c\u53ef\u4ee5\u88ab\u5b58\u50a8\u4e3a\u6570\u7ec4\uff0c\u4f7f\u7528\u65b9\u62ec\u53f7 `&#91;]` \u5305\u56f4\u3002\n3. **\u5d4c\u5957**\uff1aJSON \u5bf9\u8c61\u53ef\u4ee5\u5305\u542b\u5176\u4ed6\u5bf9\u8c61\u6216\u6570\u7ec4\uff0c\u5f62\u6210\u5d4c\u5957\u7ed3\u6784\u3002\n4. **\u6570\u636e\u7c7b\u578b**\uff1aJSON \u652f\u6301\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff0c\u5305\u62ec\u5b57\u7b26\u4e32\uff08\u7528\u53cc\u5f15\u53f7 `\"` \u5305\u56f4\uff09\u3001\u6570\u5b57\u3001\u5e03\u5c14\u503c\uff08`true` \u6216 `false`\uff09\u3001null \u4ee5\u53ca\u6570\u7ec4\u548c\u5bf9\u8c61\u3002\n5. **\u5927\u5c0f\u5199\u654f\u611f**\uff1aJSON \u7684\u952e\u540d\u662f\u5927\u5c0f\u5199\u654f\u611f\u7684\u3002\n\n\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684 JSON \u793a\u4f8b\uff0c\u63cf\u8ff0\u4e86\u4e00\u4e2a\u56fe\u4e66\u5217\u8868\uff1a\n\n```json\n{\n    \"bookstore\": {\n        \"books\": &#91;\n            {\n                \"title\": \"PHP Programming\",\n                \"author\": \"John Doe\",\n                \"genre\": \"Computer\",\n                \"price\": 29.99,\n                \"publish_date\": \"2020-01-01\"\n            },\n            {\n                \"title\": \"Learning JSON\",\n                \"author\": \"Jane Smith\",\n                \"genre\": \"Technology\",\n                \"price\": 19.95,\n                \"publish_date\": \"2021-06-15\"\n            }\n        ]\n    }\n}\n```\n\n\u89e3\u91ca\uff1a\n\n- JSON \u5bf9\u8c61\u4ee5\u5927\u62ec\u53f7 `{}` \u5f00\u59cb\u548c\u7ed3\u675f\u3002\n- `\"bookstore\"` \u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5b83\u5305\u542b\u4e00\u4e2a\u540d\u4e3a `\"books\"` \u7684\u952e\uff0c\u8be5\u952e\u5bf9\u5e94\u4e00\u4e2a\u6570\u7ec4\u3002\n- \u6570\u7ec4\u4e2d\u7684\u6bcf\u4e2a\u5143\u7d20\u4e5f\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4ee3\u8868\u4e00\u4e2a\u56fe\u4e66\u6761\u76ee\u3002\n- \u6bcf\u4e2a\u56fe\u4e66\u5bf9\u8c61\u5305\u542b\u591a\u4e2a\u952e\u503c\u5bf9\uff0c\u63cf\u8ff0\u4e86\u56fe\u4e66\u7684\u4e0d\u540c\u5c5e\u6027\u3002\n\nJSON \u683c\u5f0f\u7531\u4e8e\u5176\u7b80\u6d01\u6027\u548c\u6613\u4e8e\u89e3\u6790\u7684\u7279\u6027\uff0c\u5728 Web \u670d\u52a1\u548c\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u7684\u6570\u636e\u4ea4\u6362\u4e2d\u975e\u5e38\u6d41\u884c\uff0c\u5b83\u901a\u5e38\u7528\u4e8e RESTful API \u7684\u54cd\u5e94\u548c\u8bf7\u6c42\u6570\u636e\u683c\u5f0f\u3002<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":""},"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/46729"}],"collection":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=46729"}],"version-history":[{"count":1,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/46729\/revisions"}],"predecessor-version":[{"id":46730,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/46729\/revisions\/46730"}],"wp:attachment":[{"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=46729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=46729"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.biocloudservice.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=46729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}