{"id":687,"date":"2023-02-26T14:45:36","date_gmt":"2023-02-26T06:45:36","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=687"},"modified":"2023-04-29T17:57:42","modified_gmt":"2023-04-29T09:57:42","slug":"fastjson-and-gson-define-field-aliases","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/26\/fastjson-and-gson-define-field-aliases\/","title":{"rendered":"FastJson\u53caGson\u5b9a\u4e49\u5b57\u6bb5\u522b\u540d"},"content":{"rendered":"<p>\u5982\u679c\u5f00\u53d1\u8bbe\u8ba1Model\u7684\u5b57\u6bb5\u540d\u548c\u7f51\u7edc\u4f20\u8f93Json\u7684\u5b57\u6bb5\u540d\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u5bfc\u81f4Json\u6846\u67b6\uff08\u5982FastJson\u548cGson\uff09\u4e0d\u80fd\u6210\u529f\u89e3\u6790\uff0c\u6b64\u65f6\u9700\u8981\u5229\u7528FastJson\u548cGson\u5b9a\u4e49\u5b57\u6bb5\u522b\u540d\uff0c\u5b9e\u73b0Model\u5b57\u6bb5\u548cJson\u5b57\u6bb5\u7684\u5339\u914d\u3002<\/p>\n<h2>FastJson<\/h2>\n<p><!-- more --><\/p>\n<pre><code>@JSONField(&quot;username&quot;)\nprivate String userName;\n\n@JSONField(name = &quot;username&quot;)\nprivate String userName;\n\n@JSONField(alternateNames = {&quot;username&quot;, &quot;user_name&quot;})\nprivate String userName;<\/code><\/pre>\n<h2>Gson<\/h2>\n<pre><code>@SerializedName(&quot;username&quot;)\nprivate String userName;\n\n@SerializedName(value = &quot;username&quot;)\nprivate String userName;\n\n@SerializedName(value = &quot;userName&quot;, alternate = {&quot;username&quot;, &quot;user_name&quot;})\nprivate String userName;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u5f00\u53d1\u8bbe\u8ba1Model\u7684\u5b57\u6bb5\u540d\u548c\u7f51\u7edc\u4f20\u8f93Json\u7684\u5b57\u6bb5\u540d\u4e0d\u4e00\u81f4\uff0c\u53ef\u80fd\u5bfc\u81f4Json\u6846\u67b6\uff08\u5982FastJson\u548cGs [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[58,118],"class_list":["post-687","post","type-post","status-publish","format-standard","hentry","category-java-basic","tag-fastjson","tag-gson"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/687","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=687"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/687\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=687"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=687"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=687"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}