{"id":1533,"date":"2025-03-14T21:20:37","date_gmt":"2025-03-14T13:20:37","guid":{"rendered":"http:\/\/codermr.com\/?p=1533"},"modified":"2025-03-14T22:30:15","modified_gmt":"2025-03-14T14:30:15","slug":"json-%e4%b8%8e-json5","status":"publish","type":"post","link":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/","title":{"rendered":"JSON \u4e0e JSON5"},"content":{"rendered":"\n<p><strong>JSON<\/strong>\uff08JavaScript Object Notation,&nbsp;<a href=\"https:\/\/zh.wikipedia.org\/wiki\/Help:%E8%8B%B1%E8%AA%9E%E5%9C%8B%E9%9A%9B%E9%9F%B3%E6%A8%99\">\/\u02c8d\u0292e\u026as\u0259n\/<\/a>, JavaScript\u5bf9\u8c61\u8868\u793a\u6cd5\uff09\u662f\u7531<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E7%BE%8E%E5%9C%8B\">\u7f8e\u56fd<\/a>\u7a0b\u5e8f\u5458<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E9%81%93%E6%A0%BC%E6%8B%89%E6%96%AF%C2%B7%E5%85%8B%E7%BE%85%E5%85%8B%E7%A6%8F%E7%89%B9\">\u9053\u683c\u62c9\u65af\u00b7\u514b\u7f57\u514b\u798f\u7279<\/a>\u6784\u60f3\u548c\u8bbe\u8ba1\u7684\u4e00\u79cd\u8f7b\u91cf\u7ea7<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%95%B0%E6%8D%AE%E4%BA%A4%E6%8D%A2\">\u8d44\u6599\u4ea4\u6362\u683c\u5f0f<\/a>\u3002\u5176\u5185\u5bb9\u7531\u5c5e\u6027\u548c\u503c\u6240\u7ec4\u6210\uff0c\u56e0\u6b64\u4e5f\u6709\u6613\u4e8e\u9605\u8bfb\u548c\u5904\u7406\u7684\u4f18\u52bf\u3002JSON\u662f\u72ec\u7acb\u4e8e<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80\">\u7f16\u7a0b\u8bed\u8a00<\/a>\u7684<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%96%87%E6%9C%AC%E6%96%87%E4%BB%B6\">\u8d44\u6599\u683c\u5f0f<\/a>\uff0c\u5176\u4e0d\u4ec5\u662f<a href=\"https:\/\/zh.wikipedia.org\/wiki\/JavaScript\">JavaScript<\/a>\u7684\u5b50\u96c6\uff0c\u4e5f\u91c7\u7528\u4e86<a href=\"https:\/\/zh.wikipedia.org\/wiki\/C%E8%AA%9E%E8%A8%80\">C\u8bed\u8a00<\/a>\u5bb6\u65cf\u7684\u4e60\u60ef\u7528\u6cd5\uff0c\u76ee\u524d\u4e5f\u6709\u8bb8\u591a\u7f16\u7a0b\u8bed\u8a00\u90fd\u80fd\u591f\u5c06\u5176<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E8%AF%AD%E6%B3%95%E5%88%86%E6%9E%90%E5%99%A8\">\u89e3\u6790\u548c\u5b57\u7b26\u4e32\u5316<\/a>\uff0c\u5176\u5e7f\u6cdb\u4f7f\u7528\u7684\u7a0b\u5ea6\u4e5f\u4f7f\u5176\u6210\u4e3a\u901a\u7528\u7684\u8d44\u6599\u683c\u5f0f\u3002<\/p>\n\n\n\n<p>JSON\u683c\u5f0f\u662f1999\u5e74\u300a<em>JavaScript Programming Language, Standard ECMA-262 3rd Edition<\/em>\u300b\u7684\u5b50\u96c6\u5408\uff0c<strong>\u6240\u4ee5\u53ef\u4ee5\u5728<a href=\"https:\/\/zh.wikipedia.org\/wiki\/JavaScript\">JavaScript<\/a>\u4ee5 <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">eval()<\/mark><\/code> \u51fd\u6570\uff08javascript\u901a\u8fc7eval()\u8c03\u7528\u89e3\u6790\u5668\uff09\u8bfb\u5165<\/strong>\u3002\u4e0d\u8fc7\u8fd9\u5e76\u4e0d\u4ee3\u8868JSON\u65e0\u6cd5\u4f7f\u7528\u4e8e\u5176\u4ed6\u8bed\u8a00\uff0c\u4e8b\u5b9e\u4e0a\u51e0\u4e4e\u6240\u6709\u4e0e\u7f51\u7edc\u5f00\u53d1\u76f8\u5173\u7684\u8bed\u8a00\u90fd\u6709JSON\u51fd\u6570\u5e93\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>JSON\u7684\u57fa\u672c\u6570\u636e\u7c7b\u578b\uff086\u79cd\uff09\uff1a<\/strong><\/h1>\n\n\n\n<ul>\n<li><strong>\u6570\u503c<\/strong>\uff1a\u5341\u8fdb\u5236\u6570\uff0c\u4e0d\u80fd\u6709\u524d\u5bfc0\uff0c\u53ef\u4ee5\u4e3a\u8d1f\u6570\uff0c\u53ef\u4ee5\u6709\u5c0f\u6570\u90e8\u5206\u3002\u8fd8\u53ef\u4ee5\u7528<code><strong>e<\/strong><\/code>\u6216\u8005<code><strong>E<\/strong><\/code>\u8868\u793a\u6307\u6570\u90e8\u5206\u3002\u4e0d\u80fd\u5305\u542b\u975e\u6570\uff0c\u5982NaN\u3002<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u4e0d\u533a\u5206\u6574\u6570\u4e0e\u6d6e\u70b9\u6570<\/mark><\/strong>\u3002JavaScript\u7528\u53cc\u7cbe\u5ea6<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%B5%AE%E7%82%B9%E6%95%B0\">\u6d6e\u70b9\u6570<\/a>\u8868\u793a\u6240\u6709\u6570\u503c\uff08\u540e\u6765\u4e5f\u652f\u6301 BigInt<sup><a href=\"https:\/\/zh.wikipedia.org\/wiki\/JSON#cite_note-1\">[1]<\/a><\/sup>\uff09\u3002<\/li>\n\n\n\n<li><strong>\u5b57\u7b26\u4e32<\/strong>\uff1a\u4ee5\u53cc\u5f15\u53f7<code><strong>\"\"<\/strong><\/code>\u62ec\u8d77\u6765\u7684\u96f6\u4e2a\u6216\u591a\u4e2a<a href=\"https:\/\/zh.wikipedia.org\/wiki\/Unicode\">Unicode<\/a><a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E7%A0%81%E4%BD%8D\">\u7801\u4f4d<\/a>\u3002\u652f\u6301<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%8F%8D%E6%96%9C%E6%9D%A0\">\u53cd\u659c\u6760<\/a>\u5f00\u59cb\u7684<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6%E5%BA%8F%E5%88%97\">\u8f6c\u4e49\u5b57\u7b26\u5e8f\u5217<\/a>\u3002<\/li>\n\n\n\n<li><strong>\u5e03\u5c14\u503c<\/strong>\uff1a\u8868\u793a\u4e3a<code>true<\/code>\u6216\u8005<code>false<\/code>\u3002<\/li>\n\n\n\n<li><strong>\u6570\u7ec4<\/strong>\uff1a\u6709\u5e8f\u7684\u96f6\u4e2a\u6216\u8005\u591a\u4e2a\u503c\u3002\u6bcf\u4e2a\u503c\u53ef\u4ee5\u4e3a\u4efb\u610f\u7c7b\u578b\u3002\u6570\u7ec4\u4f7f\u7528\u65b9\u62ec\u53f7<code><strong>[]<\/strong><\/code>\u5305\u88f9\u3002\u591a\u4e2a\u6570\u7ec4\u5143\u7d20\u4e4b\u95f4\u7528\u9017\u53f7<code><strong>,<\/strong><\/code>\u5206\u9694\uff0c\u5f62\u5982\uff1a<code>[value, value]<\/code>\u3002<\/li>\n\n\n\n<li><strong>\u5bf9\u8c61<\/strong>\uff1a\u82e5\u5e72\u65e0\u5e8f\u7684\u201c\u952e-\u503c\u5bf9\u201d(key-value pairs)\uff0c\u5176\u4e2d\u952e\u53ea\u80fd\u662f\u5b57\u7b26\u4e32<sup><a href=\"https:\/\/zh.wikipedia.org\/wiki\/JSON#cite_note-2\">[2]<\/a><\/sup>\u3002\u5efa\u8bae\u4f46\u4e0d\u5f3a\u5236\u8981\u6c42\u5bf9\u8c61\u4e2d\u7684\u952e\u662f\u72ec\u4e00\u65e0\u4e8c\u7684\u3002<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">\u5bf9\u8c61\u4ee5\u82b1\u62ec\u53f7<code><strong>{}<\/strong><\/code>\u5305\u88f9\u3002\u591a\u4e2a\u952e-\u503c\u5bf9\u4e4b\u95f4\u4f7f\u7528\u9017\u53f7<code><strong>,<\/strong><\/code>\u5206\u9694\u3002\u952e\u4e0e\u503c\u4e4b\u95f4\u7528\u5192\u53f7<code><strong>:<\/strong><\/code>\u5206\u9694<\/mark>\u3002<\/li>\n\n\n\n<li><strong>\u7a7a\u503c<\/strong>\uff1a\u503c\u5199\u4e3a<code>null<\/code><\/li>\n<\/ul>\n\n\n\n<p>token\uff086\u79cd\u6807\u70b9\u7b26\u53f7\u3001\u5b57\u7b26\u4e32\u3001\u6570\u503c\u30013\u79cd\u5b57\u9762\u91cf\uff09\u4e4b\u95f4\u53ef\u4ee5\u5b58\u5728\u6709\u9650\u7684\u7a7a\u767d\u7b26\u5e76\u88ab\u5ffd\u7565\u3002<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><strong>\u56db\u4e2a\u7279\u5b9a\u5b57\u7b26\u88ab\u8ba4\u4e3a\u662f\u7a7a\u767d\u7b26\uff1a<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E7%A9%BA%E6%A0%BC%E7%AC%A6\">\u7a7a\u683c\u7b26<\/a>\u3001<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%B0%B4%E5%B9%B3%E5%88%B6%E8%A1%A8%E7%AC%A6\">\u6c34\u5e73\u5236\u8868\u7b26<\/a>\u3001<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%9B%9E%E8%BD%A6%E7%AC%A6\">\u56de\u8f66\u7b26<\/a>\u3001<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E6%8D%A2%E8%A1%8C%E7%AC%A6\">\u6362\u884c\u7b26<\/a>\u3002\u7a7a\u767d\u7b26\u4e0d\u80fd\u51fa\u73b0\u5728token\u5185\u90e8\uff08\u4f46\u7a7a\u683c\u7b26\u53ef\u4ee5\u51fa\u73b0\u5728\u5b57\u7b26\u4e32\u5185\u90e8\uff09\u3002<\/strong><\/mark>JSON\u6807\u51c6\u4e0d\u5141\u8bb8\u6709<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%AD%97%E8%8A%82%E5%BA%8F%E6%8E%A9%E7%A0%81\">\u5b57\u8282\u5e8f\u63a9\u7801<\/a>\uff0c\u4e0d\u63d0\u4f9b\u6ce8\u91ca\u7684\u53e5\u6cd5\u3002 \u4e00\u4e2a\u6709\u6548\u7684JSON\u6587\u6863\u7684\u6839\u8282\u70b9\u5fc5\u987b\u662f\u4e00\u4e2a\u5bf9\u8c61\u6216\u4e00\u4e2a\u6570\u7ec4\u3002<\/p>\n\n\n\n<p>JSON\u4ea4\u6362\u65f6\u5fc5\u987b\u7f16\u7801\u4e3a<a href=\"https:\/\/zh.wikipedia.org\/wiki\/UTF-8\">UTF-8<\/a>\u3002<sup><a href=\"https:\/\/zh.wikipedia.org\/wiki\/JSON#cite_note-rfc8259-3\">[3]<\/a><\/sup>\u8f6c\u4e49\u5e8f\u5217\u53ef\u4ee5\u4e3a\uff1a\u201c\\\\\u201d\u3001\u201c\\&#8221;\u201d\u3001\u201c\\\/\u201d\u3001\u201c\\b\u201d\u3001\u201c\\f\u201d\u3001\u201c\\n\u201d\u3001\u201c\\r\u201d\u3001\u201c\\t\u201d\uff0c\u6216<a href=\"https:\/\/zh.wikipedia.org\/wiki\/Unicode\">Unicode<\/a>16\u8fdb\u5236\u8f6c\u4e49\u5b57\u7b26\u5e8f\u5217\uff08\\u\u540e\u9762\u8ddf\u968f4\u4f4d<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%8D%81%E5%85%AD%E8%BF%9B%E5%88%B6\">16\u8fdb\u5236\u6570\u5b57<\/a>\uff09\u3002\u5bf9\u4e8e\u4e0d\u5728<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E5%9F%BA%E6%9C%AC%E5%A4%9A%E6%96%87%E7%A8%AE%E5%B9%B3%E9%9D%A2\">\u57fa\u672c\u591a\u6587\u79cd\u5e73\u9762<\/a>\u4e0a\u7684<a href=\"https:\/\/zh.wikipedia.org\/wiki\/%E7%A0%81%E4%BD%8D\">\u7801\u4f4d<\/a>\uff0c\u5fc5\u987b\u7528<a href=\"https:\/\/zh.wikipedia.org\/wiki\/UTF-16\">UTF-16<\/a>\u4ee3\u7406\u5bf9\uff08surrogate pair\uff09\u8868\u793a\uff0c<strong>\u4f8b\u5982\u5bf9\u4e8e<a href=\"https:\/\/zh.wikipedia.org\/wiki\/Emoji\">Emoji<\/a>\u5b57\u7b26\u2014\u2014\u559c\u6781\u800c\u6ce3\u7684\u8868\u60c5\uff08U+1F602&nbsp;\ud83d\ude02&nbsp;FACE WITH TEARS OF JOY\uff09\u5728JSON\u4e2d\u5e94\u8868\u793a\u4e3a\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{ \"face\": \"\ud83d\ude02\" }<\/code><\/pre>\n\n\n\n<p>\u6216\u8005\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{ \"face\": \"\\uD83D\\uDE02\" }<\/code><\/pre>\n\n\n\n<p>JSON\u7684\u683c\u5f0f\u63cf\u8ff0\u53ef\u4ee5\u53c2\u8003RFC 4627\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">JSON \u7684\u75db\u70b9<\/h1>\n\n\n\n<ul>\n<li><strong>\u75db\u70b9\u4e00\uff1a\u4e0d\u80fd\u518d\u6ce8\u91ca\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u901a\u5e38\uff0c\u53ef\u4ee5\u7528 \/\/ \u6216\u8005 # \u7b49\u4f5c\u4e3a\u6ce8\u91ca\uff0c\u4f46\u662f JSON \u4e2d\u4e0d\u652f\u6301\u3002<\/p>\n\n\n\n<ul>\n<li><strong>\u75db\u70b9\u4e8c\uff1a\u5e8f\u5217\u5316\u4e4b\u540e\u7684 key \u88ab\u52a0\u4e0a\u4e86\u53cc\u5f15\u53f7\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u6bd4\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static class Cls {\n    private String name;\n    private Integer age;\n}\n\npublic static void main(String&#91;] args) {\n    Cls obj = new Cls();\n    obj.setAge(100);\n    obj.setName(\"zhangsan\");\n    System.out.println(JSON.toJSONString(obj));\n\n}<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\t\"age\": 100,\n\t\"name\": \"zhangsan\"\n}<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u53d1\u73b0\uff0c\u5c06\u5bf9\u8c61\u8f6c\u4e3a\u5b57\u7b26\u4e32\u540e\uff0ckey \u90fd\u52a0\u4e0a\u4e86\u5f15\u53f7 \u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">JSON5 \u89c4\u8303<\/h1>\n\n\n\n<p>JSON5 is an extension to the popular&nbsp;<a href=\"https:\/\/tools.ietf.org\/html\/rfc7159\">JSON<\/a>&nbsp;file format that <strong><em>aims to<\/em><\/strong> be easier to&nbsp;<strong>write and maintain&nbsp;<em>by hand<\/em>&nbsp;(e.g. for config files)<\/strong>. It is&nbsp;<em>not intended<\/em>&nbsp;to be used for machine-to-machine communication. (Keep using JSON or other file formats for that. \ud83d\ude42)<\/p>\n\n\n\n<p>JSON5 was started in 2012, and <strong><em>as of 2022\uff08\u622a\u81f3 2022 \u5e74\uff09<\/em><\/strong>, now gets&nbsp;<strong><a href=\"https:\/\/www.npmjs.com\/package\/json5\">&gt;65M downloads\/week<\/a><\/strong>, ranks in the&nbsp;<strong><a href=\"https:\/\/gist.github.com\/anvaka\/8e8fa57c7ee1350e3491\">top 0.1%<\/a><\/strong>&nbsp;of the most depended-upon packages on npm, and has been <strong><em>adopted<\/em><\/strong> by major projects like&nbsp;<strong><a href=\"https:\/\/source.chromium.org\/chromium\/chromium\/src\/+\/main:third_party\/blink\/renderer\/platform\/runtime_enabled_features.json5;drc=5de823b36e68fd99009a29281b17bc3a1d6b329c\">Chromium<\/a>,&nbsp;<a href=\"https:\/\/github.com\/vercel\/next.js\/blob\/b88f20c90bf4659b8ad5cb2a27956005eac2c7e8\/packages\/next\/lib\/find-config.ts#L43-L46\">Next.js<\/a>,&nbsp;<a href=\"https:\/\/babeljs.io\/docs\/en\/config-files#supported-file-extensions\">Babel<\/a>,&nbsp;<a href=\"https:\/\/community.retool.com\/t\/i-am-attempting-to-append-several-text-fields-to-a-google-sheet-but-receiving-a-json5-invalid-character-error\/7626\">Retool<\/a>,&nbsp;<a href=\"https:\/\/www.jetbrains.com\/help\/webstorm\/json.html\">WebStorm<\/a>, and&nbsp;<a href=\"https:\/\/github.com\/json5\/json5\/wiki\/In-the-Wild\">more<\/a><\/strong>. It&#8217;s also natively supported on&nbsp;<strong><a href=\"https:\/\/developer.apple.com\/documentation\/foundation\/jsondecoder\/3766916-allowsjson5\">Apple platforms<\/a><\/strong>&nbsp;like&nbsp;<strong>MacOS<\/strong>&nbsp;and&nbsp;<strong>iOS<\/strong>.<\/p>\n\n\n\n<p>Formally, the&nbsp;<strong><a href=\"https:\/\/spec.json5.org\/\">JSON5 Data Interchange Format<\/a><\/strong>&nbsp;is a superset of JSON (so valid JSON files will always be valid JSON5 files) that expands its syntax to include some productions from&nbsp;<a href=\"https:\/\/www.ecma-international.org\/ecma-262\/5.1\/\">ECMAScript 5.1<\/a>&nbsp;(ES5). It&#8217;s also a&nbsp;<em>subset<\/em>&nbsp;of ES5, so valid JSON5 files will always be valid ES5.<a href=\"https:\/\/json5.org\/#ecmascript-compatibility\">*<\/a><\/p>\n\n\n\n<p>JSON5 \u6570\u636e\u4ea4\u6362\u683c\u5f0f\u662f JSON \u7684\u8d85\u96c6\uff08\u56e0\u6b64\u6709\u6548\u7684 JSON \u6587\u4ef6\u59cb\u7ec8\u662f\u6709\u6548\u7684 JSON5 \u6587\u4ef6\uff09\uff0c\u5b83\u6269\u5c55\u4e86\u8bed\u6cd5\u4ee5\u5305\u542b ECMAScript 5.1\uff08ES5\uff09\u4e2d\u7684\u4e00\u4e9b\u4ea7\u54c1\u3002<\/p>\n\n\n\n<p>This JavaScript library is a reference implementation for JSON5 parsing and serialization, and is directly used in many of the popular projects mentioned above (where e.g. extreme performance isn&#8217;t necessary), but others have created&nbsp;<a href=\"https:\/\/github.com\/json5\/json5\/wiki\/In-the-Wild\">many other libraries<\/a>&nbsp;across many other platforms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"summary-of-features\">Summary of Features<\/h2>\n\n\n\n<p>The following ECMAScript 5.1 features, which are not supported in JSON, have been extended to JSON5.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"objects\">Objects<\/h3>\n\n\n\n<ul>\n<li>Object keys may be an ECMAScript 5.1&nbsp;<em><a href=\"https:\/\/www.ecma-international.org\/ecma-262\/5.1\/#sec-7.6\">IdentifierName<\/a><\/em>.\u3010\u5bf9\u8c61\u7684 key \u53ef\u4ee5\u8ddf JavaScript \u4e2d\u5bf9\u8c61 key \u5b8c\u5168\u4e00\u81f4\u3011<\/li>\n\n\n\n<li>Objects may have a single trailing comma.\u3010\u672b\u5c3e\u53ef\u4ee5\u6709\u4e00\u4e2a\u9017\u53f7\u3011<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"arrays\">Arrays<\/h3>\n\n\n\n<ul>\n<li>Arrays may have a single trailing comma.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"strings\">Strings<\/h3>\n\n\n\n<ul>\n<li>Strings may be single quoted.\u3010\u5b57\u7b26\u4e32\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u3011<\/li>\n\n\n\n<li>Strings may span multiple lines by escaping new line characters.\u3010\u5b57\u7b26\u4e32\u53ef\u4ee5\u7528\u53cd\u5f15\u53f7\u3011<\/li>\n\n\n\n<li>Strings may include <strong><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">character escapes<\/mark><\/em><\/strong>.\u3010\u5b57\u7b26\u4e32\u53ef\u4ee5\u7528\u8f6c\u4e49\u5b57\u7b26\u3011<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"numbers\">Numbers<\/h3>\n\n\n\n<ul>\n<li>Numbers may be <strong><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">hexadecimal<\/mark><\/em><\/strong>.\u3010\u6570\u5b57\u53ef\u4ee5\u662f 16 \u8fdb\u5236\u3011<\/li>\n\n\n\n<li>Numbers may have <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">a leading or <strong><em>trailing(\u8ffd\u8e2a)<\/em><\/strong> decimal point<\/mark>.\u3010\u6570\u5b57\u53ef\u4ee5\u7528\u70b9\u5f00\u5934\u6216\u7ed3\u5c3e\u3011<\/li>\n\n\n\n<li>Numbers may be&nbsp;<a href=\"http:\/\/ieeexplore.ieee.org\/servlet\/opac?punumber=4610933\">IEEE 754<\/a>&nbsp;<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">positive infinity<\/mark><\/strong>, <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\"><strong>negative infinity<\/strong><\/mark>, and NaN.\u3010\u6570\u5b57\u53ef\u4ee5\u8868\u793a\u6b63\u65e0\u7a77\u3001\u8d1f\u65e0\u7a77\u548cNaN.\u3011<\/li>\n\n\n\n<li>Numbers may begin with an explicit <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">plus sign<\/mark><\/strong>.\u3010\u6570\u5b57\u53ef\u4ee5\u7528\u52a0\u53f7\u5f00\u5934\u3011<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"comments\">Comments<\/h3>\n\n\n\n<ul>\n<li>Single and multi-line comments are allowed.\u3010\u652f\u6301\u5355\u884c\u548c\u591a\u884c\u6ce8\u91ca\u3011<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"white-space\">White Space<\/h3>\n\n\n\n<ul>\n<li>Additional white space characters are allowed.\u3010\u5141\u8bb8\u591a\u4f59\u7684\u7a7a\u683c\u3011<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Java\u4e2d\u600e\u4e48\u4f7f\u7528 JSON5 \uff1f<\/h1>\n\n\n\n<p>\u5f88\u9057\u61be\uff0c\u76ee\u524d\u7684\u4e3b\u6d41 Java JSON \u5e93\u5927\u90fd\u4e0d\u652f\u6301 JSON5 \uff0c\u6bd4\u5982\u963f\u91cc\u5df4\u5df4\u5f00\u6e90\u7684 JSON \u5e93 <strong>Fastjson \u4e0d\u652f\u6301 JSON5<\/strong>\u3002\u5b83\u53ea\u80fd\u5904\u7406\u6807\u51c6\u7684 JSON \u683c\u5f0f\uff0c\u65e0\u6cd5\u89e3\u6790 JSON5 \u7684\u7279\u6027\uff08\u5982\u6ce8\u91ca\u3001\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u3001\u5c3e\u968f\u9017\u53f7\u7b49\uff09\u3002<code>Jackson<\/code>&nbsp;\u662f\u53e6\u4e00\u4e2a\u5e7f\u6cdb\u4f7f\u7528\u7684 JSON \u5e93\uff0c\u529f\u80fd\u5f3a\u5927\u4e14\u6269\u5c55\u6027\u5f3a\u3002<strong>Jackson \u672c\u8eab\u4e5f\u4e0d\u76f4\u63a5\u652f\u6301 JSON5<\/strong>\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u6269\u5c55\u6765\u5b9e\u73b0\u5bf9 JSON5 \u7684\u652f\u6301\uff08\u5177\u4f53\u53ef\u4ee5\u4e0a\u7f51\u67e5\u8be2\u76f8\u5173\u8d44\u6599\uff09\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u76f8\u5173\u6587\u7ae0\uff1a<a href=\"https:\/\/json5.org\/\">https:\/\/json5.org\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>JSON\uff08JavaScript Object Notation,&nbsp;\/\u02c8d\u0292e\u026as\u0259n\/, JavaS&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[68],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-\u4e0e-json5\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"og:description\" content=\"JSON\uff08JavaScript Object Notation,&nbsp;\/\u02c8d\u0292e\u026as\u0259n\/, JavaS...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-\u4e0e-json5\/\" \/>\n<meta property=\"og:site_name\" content=\"\u7801\u5148\u751f\u7684\u535a\u5ba2\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-14T13:20:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-14T14:30:15+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/json\u56fe\u68071.png\" \/>\n\t<meta property=\"og:image:width\" content=\"299\" \/>\n\t<meta property=\"og:image:height\" content=\"299\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"\u7801\u5148\u751f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/mrcode2021\" \/>\n<meta name=\"twitter:site\" content=\"@mrcode2021\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u7801\u5148\u751f\" \/>\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\":\"Article\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/\"},\"author\":{\"name\":\"\u7801\u5148\u751f\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"headline\":\"JSON \u4e0e JSON5\",\"datePublished\":\"2025-03-14T13:20:37+00:00\",\"dateModified\":\"2025-03-14T14:30:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/\"},\"wordCount\":425,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"keywords\":[\"json\"],\"articleSection\":[\"\u7f16\u7a0b\u5468\u8fb9\u6280\u672f\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/\",\"url\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/\",\"name\":\"JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2\",\"isPartOf\":{\"@id\":\"http:\/\/codermr.com\/#website\"},\"datePublished\":\"2025-03-14T13:20:37+00:00\",\"dateModified\":\"2025-03-14T14:30:15+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/codermr.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JSON \u4e0e JSON5\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/codermr.com\/#website\",\"url\":\"http:\/\/codermr.com\/\",\"name\":\"\u7801\u5148\u751f\u7684\u535a\u5ba2\",\"description\":\"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP\",\"publisher\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/codermr.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf\",\"name\":\"\u7801\u5148\u751f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"contentUrl\":\"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg\",\"width\":400,\"height\":400,\"caption\":\"\u7801\u5148\u751f\"},\"logo\":{\"@id\":\"http:\/\/codermr.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/codermr.com\",\"https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021\"],\"url\":\"http:\/\/codermr.com\/index.php\/author\/coderma\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2","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":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-\u4e0e-json5\/","og_locale":"zh_CN","og_type":"article","og_title":"JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2","og_description":"JSON\uff08JavaScript Object Notation,&nbsp;\/\u02c8d\u0292e\u026as\u0259n\/, JavaS...","og_url":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-\u4e0e-json5\/","og_site_name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","article_published_time":"2025-03-14T13:20:37+00:00","article_modified_time":"2025-03-14T14:30:15+00:00","og_image":[{"width":299,"height":299,"url":"http:\/\/codermr.com\/wp-content\/uploads\/2025\/03\/json\u56fe\u68071.png","type":"image\/png"}],"author":"\u7801\u5148\u751f","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/mrcode2021","twitter_site":"@mrcode2021","twitter_misc":{"\u4f5c\u8005":"\u7801\u5148\u751f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#article","isPartOf":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/"},"author":{"name":"\u7801\u5148\u751f","@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"headline":"JSON \u4e0e JSON5","datePublished":"2025-03-14T13:20:37+00:00","dateModified":"2025-03-14T14:30:15+00:00","mainEntityOfPage":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/"},"wordCount":425,"commentCount":0,"publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"keywords":["json"],"articleSection":["\u7f16\u7a0b\u5468\u8fb9\u6280\u672f"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/","url":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/","name":"JSON \u4e0e JSON5 - \u7801\u5148\u751f\u7684\u535a\u5ba2","isPartOf":{"@id":"http:\/\/codermr.com\/#website"},"datePublished":"2025-03-14T13:20:37+00:00","dateModified":"2025-03-14T14:30:15+00:00","breadcrumb":{"@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/codermr.com\/index.php\/2025\/03\/14\/json-%e4%b8%8e-json5\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/codermr.com\/"},{"@type":"ListItem","position":2,"name":"JSON \u4e0e JSON5"}]},{"@type":"WebSite","@id":"http:\/\/codermr.com\/#website","url":"http:\/\/codermr.com\/","name":"\u7801\u5148\u751f\u7684\u535a\u5ba2","description":"\u6b22 \u8fce \u4e0b \u8f7d \u6211 \u5f00 \u53d1 \u7684 \u5404 \u7aef \u8f6f \u4ef6 \u548c APP","publisher":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/codermr.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/codermr.com\/#\/schema\/person\/39016e15c79e4f02d1ed3a64688619bf","name":"\u7801\u5148\u751f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/","url":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","contentUrl":"http:\/\/codermr.com\/wp-content\/uploads\/2023\/02\/wukong.jpg","width":400,"height":400,"caption":"\u7801\u5148\u751f"},"logo":{"@id":"http:\/\/codermr.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/codermr.com","https:\/\/twitter.com\/https:\/\/twitter.com\/mrcode2021"],"url":"http:\/\/codermr.com\/index.php\/author\/coderma\/"}]}},"_links":{"self":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1533"}],"collection":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/comments?post=1533"}],"version-history":[{"count":8,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1533\/revisions"}],"predecessor-version":[{"id":1554,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/posts\/1533\/revisions\/1554"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media\/1534"}],"wp:attachment":[{"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/media?parent=1533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/categories?post=1533"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/codermr.com\/index.php\/wp-json\/wp\/v2\/tags?post=1533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}