{"id":405,"date":"2019-07-09T16:45:34","date_gmt":"2019-07-09T08:45:34","guid":{"rendered":"https:\/\/www.myway5.com\/?p=405"},"modified":"2023-07-05T21:41:48","modified_gmt":"2023-07-05T13:41:48","slug":"go-json","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/","title":{"rendered":"go\u5904\u7406\u591a\u6001\u7684JSON"},"content":{"rendered":"\r\n<p>\u6700\u8fd1\u4f7f\u7528go\u5728\u5bf9h2o\u7684REST API\u8fdb\u884c\u5c01\u88c5\u65f6\uff0c\u53d1\u73b0\u4e86h2o\u7684JSON\u8fd4\u56de\u503c\u4e2d\u6709<code>Polymorphic<\/code>\u7c7b\u578b\u7684\u5b57\u6bb5\u3002<code>Polymorphic<\/code>\u53ef\u4ee5\u7ffb\u8bd1\u4e3a\u591a\u6001\u3002\u4e00\u4e2a\u591a\u6001\u7684\u7c7b\u578b\u53ef\u4ee5\u7406\u89e3\u4e3a\u65e2\u53ef\u80fd\u662ffloat\u578b\uff0c\u4e5f\u53ef\u80fd\u662fstring\u7c7b\u578b\u7b49\u7b49\u3002<\/p>\r\n\r\n\r\n\r\n<p>\u5728\u6211\u7684\u7406\u89e3\u4e2d\uff0c\u4e00\u4e2aJSON\u4e2d\u6bcf\u4e2a\u5b57\u6bb5\u7684\u7c7b\u578b\u90fd\u5fc5\u987b\u662f\u786e\u5b9a\u7684\uff0c\u5728\u52a8\u6001\u8bed\u8a00\u6bd4\u5982php, js\u8fd9\u79cd\uff0c\u5904\u7406\u8fd9\u79cd\u4e0d\u786e\u5b9a\u7684\u7c7b\u578b\u5f88\u65b9\u4fbf\u3002\u4f46\u662f\u5728go\u8fd9\u79cd\u9759\u6001\u8bed\u8a00\u4e2d\uff0c\u4e00\u4e2a\u4e0d\u786e\u5b9a\u7684\u7c7b\u578b\u5bfc\u81f4\u5728\u89e3\u6790\u4e2d\u603b\u662f\u4f1a\u51fa\u73b0\u7c7b\u4f3c\u4e8e\u8fd9\u6837\u5b50\u7684\u9519\u8bef: <code>json: cannot unmarshal string into Go struct field Foo.Value of type int<\/code><\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">\u4f7f\u7528interface{}\u5904\u7406\u591a\u6001\u7684\u95ee\u9898<\/h2>\r\n\r\n\r\n\r\n<p>\u5728go\u4e2d\uff0cinterface{}\u662f\u4e00\u4e2a\u7a7a\u63a5\u53e3\uff0c\u90a3\u4e48\u6240\u6709\u7c7b\u578b\u90fd\u53ef\u4ee5\u770b\u505a\u5b9e\u73b0\u4e86\u8fd9\u4e2a\u7a7a\u63a5\u53e3\uff0c\u56e0\u6b64interface{}\u53ef\u4ee5\u63a5\u6536\u4efb\u4f55\u7c7b\u578b\u7684\u503c\u3002\u90a3\u4e48\u5982\u679c\u4e00\u4e2ajson\u65e2\u53ef\u80fd\u662f<code>{\"mean\": 123}<\/code>, \u53c8\u53ef\u80fd\u662f<code>{\"mean\": \"NaN\"}<\/code>\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u7ed3\u6784\u4f53\uff1a<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>type Prediction struct {\r\n    Mean interface{} `json:\"mean\"`\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u4f46\u662f\u5728\u4f7f\u7528Mean\u8fd9\u4e2a\u53d8\u91cf\u7684\u65f6\u5019\uff0c\u5c31\u6bd4\u8f83\u9ebb\u70e6\u4e86\u3002<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>t2 := `{\"mean\": \"NaN\"}`\r\n\r\nvar p2 Prediction\r\nerr = json.Unmarshal([]byte(t2), &p2)\r\n\r\nif err != nil {\r\n    log.Println(err)\r\n} else {\r\n    if mean, ok := p2.Mean.(string); ok {\r\n        log.Printf(\"p2 mean: %s \\n\", mean)\r\n    } else if n, ok := p2.Mean.(int); ok {\r\n        mean = strconv.Itoa(n)\r\n        log.Printf(\"p2 mean: %s \\n\", mean)\r\n    }\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">\u5b9e\u73b0Unmarshaler\u548cMarshaler\u63a5\u53e3<\/h2>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>type Marshaler interface {\r\n        MarshalJSON() ([]byte, error)\r\n}\r\n\r\ntype Unmarshaler interface {\r\n        UnmarshalJSON([]byte) error\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u5728\u4f7f\u7528<code>json.Unmarshal<\/code>\u6216<code>json.Marshal<\/code>\u65f6\uff0c\u4f1a\u81ea\u52a8\u8c03\u7528\u5bf9\u5e94\u53d8\u91cf\u7c7b\u578b\u7684<code>UnmarshalJSON<\/code>\u548c<code>MarshalJSON<\/code>\u65b9\u6cd5\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b9a\u4e49\u4e00\u4e2a<code>FlexString<\/code>\u7c7b\u578b<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>type FlexString string\r\ntype Prediction struct {\r\n    Mean FlexString `json:\"mean\"`\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u7136\u540e\u5b9e\u73b0*FlexString\u7684UnmarshalJSON\u65b9\u6cd5\u548cFlexString\u7684MarshalJSON\u65b9\u6cd5\u3002<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>func (fs *FlexString) UnmarshalJSON(b []byte) error {\r\n    if b[0] == '\"' {\r\n        return json.Unmarshal(b, (*string)(fs))\r\n    }\r\n    var n float64\r\n    if err := json.Unmarshal(b, &n); err != nil {\r\n        return err\r\n    }\r\n\r\n    s := strconv.FormatFloat(n, 'g', 15, 64)\r\n\r\n    *fs = FlexString(s)\r\n    return nil\r\n}\r\n\r\nfunc (fs FlexString) MarshalJSON() ([]byte, error) {\r\n    s := string(fs)\r\n    n, err := strconv.ParseFloat(s, 64)\r\n    if err != nil {\r\n        return json.Marshal(s)\r\n    }\r\n\r\n    if math.IsNaN(n) {\r\n        return json.Marshal(s)\r\n    }\r\n\r\n    return json.Marshal(n)\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u8fd9\u6837\u5728\u4f7f\u7528\u7684\u65f6\u5019\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u7684\u5bf9\u591a\u6001\u7684<code>Mean<\/code>\u8fdb\u884cjson\u89e3\u7801\u4ee5\u53ca\u7f16\u7801\u4e86\u3002<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>func main() {\r\n    t1 := `{\"mean\": 123.1212}`\r\n    var p1 Prediction\r\n    err := json.Unmarshal([]byte(t1), &p1)\r\n    if err != nil {\r\n        log.Println(err)\r\n    } else {\r\n        log.Println(\"p1 mean value:\", p1.Mean)\r\n    }\r\n\r\n    res1, err := json.Marshal(p1)\r\n    if err != nil {\r\n        log.Println(\"res1 error:\", err)\r\n    } else {\r\n        log.Println(\"res1 :\", string(res1))\r\n    }\r\n\r\n    t2 := `{\"mean\": \"NaN\"}`\r\n    var p2 Prediction\r\n    err = json.Unmarshal([]byte(t2), &p2)\r\n    if err != nil {\r\n        log.Println(err)\r\n    } else {\r\n        log.Println(\"p2 mean value:\", p2.Mean)\r\n    }\r\n\r\n    res2, err := json.Marshal(p2)\r\n    if err != nil {\r\n        log.Println(\"res2 error:\", err)\r\n    } else {\r\n        log.Println(\"res2 :\", string(res2))\r\n    }\r\n}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u8fd0\u884c\u7ed3\u679c\u5982\u4e0b\uff1a<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code>2019\/07\/09 16:38:42 p1 mean value: 123.1212\r\n2019\/07\/09 16:38:42 res1 : {\"mean\":123.1212}\r\n2019\/07\/09 16:38:42 p2 mean value: NaN\r\n2019\/07\/09 16:38:42 res2 : {\"mean\":\"NaN\"}<\/code><\/pre>\r\n\r\n\r\n\r\n<p>123.1212\u5728\u89e3\u7801\u518d\u7f16\u7801\u4e4b\u540e\uff0c\u4ecd\u7136\u662ffloat\u7c7b\u578b\uff0cNaN\u4ecd\u7136\u662fstring\u7c7b\u578b\u3002\u8fd9\u91cc\u6709\u4e00\u4e2a\u6ce8\u610f\u4e8b\u9879\uff0c\u5c31\u662f<code>n, err := strconv.ParseFloat(s, 64)<\/code>\u8fd9\u4e2a\u65b9\u6cd5\uff0c\u5982\u679cs\u662fNaN\u7684\u5b57\u7b26\u4e32\u5e76\u4e0d\u4f1a\u51fa\u9519\uff0c\u800c\u662f\u5c06n\u53d8\u6210\u4e00\u4e2a<code>NaN<\/code>\uff0c\u56e0\u6b64\u9700\u8981\u4f7f\u7528math.IsNaN\u8fdb\u884c\u68c0\u67e5\u3002<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u4f7f\u7528go\u5728\u5bf9h2o\u7684REST API\u8fdb\u884c\u5c01\u88c5\u65f6\uff0c\u53d1\u73b0\u4e86h2o\u7684JSON\u8fd4\u56de\u503c\u4e2d\u6709Polymorphic\u7c7b\u578b &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">go\u5904\u7406\u591a\u6001\u7684JSON<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":538,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[67],"tags":[77,88,87,86],"class_list":["post-405","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-go","tag-go","tag-json","tag-marshaljson","tag-unmarshaljson"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/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.myway5.com\/index.php\/2019\/07\/09\/go-json\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u6700\u8fd1\u4f7f\u7528go\u5728\u5bf9h2o\u7684REST API\u8fdb\u884c\u5c01\u88c5\u65f6\uff0c\u53d1\u73b0\u4e86h2o\u7684JSON\u8fd4\u56de\u503c\u4e2d\u6709Polymorphic\u7c7b\u578b &hellip; \u7ee7\u7eed\u9605\u8bfbgo\u5904\u7406\u591a\u6001\u7684JSON\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-09T08:45:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:41:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"go\u5904\u7406\u591a\u6001\u7684JSON\",\"datePublished\":\"2019-07-09T08:45:34+00:00\",\"dateModified\":\"2023-07-05T13:41:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\"},\"wordCount\":37,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png\",\"keywords\":[\"go\",\"json\",\"MarshalJSON\",\"UnmarshalJSON\"],\"articleSection\":[\"go\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\",\"name\":\"go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png\",\"datePublished\":\"2019-07-09T08:45:34+00:00\",\"dateModified\":\"2023-07-05T13:41:48+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png\",\"width\":600,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"go\u5904\u7406\u591a\u6001\u7684JSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b","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.myway5.com\/index.php\/2019\/07\/09\/go-json\/","og_locale":"zh_CN","og_type":"article","og_title":"go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u6700\u8fd1\u4f7f\u7528go\u5728\u5bf9h2o\u7684REST API\u8fdb\u884c\u5c01\u88c5\u65f6\uff0c\u53d1\u73b0\u4e86h2o\u7684JSON\u8fd4\u56de\u503c\u4e2d\u6709Polymorphic\u7c7b\u578b &hellip; \u7ee7\u7eed\u9605\u8bfbgo\u5904\u7406\u591a\u6001\u7684JSON","og_url":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2019-07-09T08:45:34+00:00","article_modified_time":"2023-07-05T13:41:48+00:00","og_image":[{"width":600,"height":300,"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png","type":"image\/png"}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"go\u5904\u7406\u591a\u6001\u7684JSON","datePublished":"2019-07-09T08:45:34+00:00","dateModified":"2023-07-05T13:41:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/"},"wordCount":37,"commentCount":0,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png","keywords":["go","json","MarshalJSON","UnmarshalJSON"],"articleSection":["go"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/","url":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/","name":"go\u5904\u7406\u591a\u6001\u7684JSON - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png","datePublished":"2019-07-09T08:45:34+00:00","dateModified":"2023-07-05T13:41:48+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2020\/01\/golang.png","width":600,"height":300},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2019\/07\/09\/go-json\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"go\u5904\u7406\u591a\u6001\u7684JSON"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":6750,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/405","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=405"}],"version-history":[{"count":4,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/405\/revisions"}],"predecessor-version":[{"id":1576,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/405\/revisions\/1576"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media\/538"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}