Write JavaBean based on JSON data

Source: Internet
Author: User

{
" UserName ": "Liyongdong", " access_token": "30efe613c8b2ecb18cec35453b2e", " expires_in": "1446055200", "Company": " ", "Station ": "VP of Finance", " userguid": "E01f8480-a992-41b0-8390-ea1c44ee", " realname": "Li Yongdong", " mangername": "Li Yongdong", " RoleName": "project company Administrator", "Appmodule": "Modify signed customer, add customer, Edit Customer", "project": [                     {" BUGUIDLV1": "Ef91aa52-11da-4bb9-9e01-3657b448ee85", " projguid": "91db795a-877d-4bba-9099-4dac2dd45f3d", " buguid": "Ccb723c0-c7d0-4412-9a65-a9832f346b45", " ProjName": "Hohhot Square", " projareaname": "North District-Hohhot Plaza", " salegroupid": "7", " salename": "Sales 2 Group", " isleader": "0"                     }                        ], "error": "0", " msg": "OK" }
  //Analytic class Javabeanpackage Com.duowan.tool;import Java.util.list;import Org.codehaus.jackson.annotate.jsonignoreproperties;import org.codehaus.jackson.annotate.jsonproperty;     public class Example {     @JsonProperty ("UserName")//property settings    private String username;     @JsonProperty ("Access_token")    private String accesstoken;     @JsonProperty ("expires_in")    private String expiresin;     @JsonProperty ("Company")    private string company;     @JsonProperty ("station")    private string station;      @JsonProperty ("Userguid")    private String userguid;     @JsonProperty (" Realname ")    private String realname;     @JsonProperty (" Mangername ")    private String mangername;     @JsonProperty ("RoleName")    private string rolename;     @JsonProperty ("AppmoduLe ")    private String appmodule;       private list<project> Project;       private string error;    private string msg;      public void Setusername (String username) {        this.username = username;   }    Publi C String GetUserName () {        return username;   }         public void Setaccesstoken (String accesstoken) {        This.accesstoken = accesstoken;   }     Public String Getaccesstoken () {        return accesstoken;   }   & nbsp;     public void Setexpiresin (String expiresin) {        This.expiresin = Expiresi n;   }    public String getexpiresin () {        return expiresin;   }& nbsp        public void Setcompany (String company) {        This.company = Company ;   }    Public String Getcompany () {        return company;   }  &NBSP;&NBSP;&NBSP;&NB Sp   public void Setstation (String station) {        this.station = station;   }  &N Bsp Public String getstation () {        return station;   }       &nbs P public void Setuserguid (String userguid) {        This.userguid = userguid;   }  &nbsp ; Public String Getuserguid () {        return userguid;   }       &N Bsp public void Setrealname (String realname) {        this.realname = realname;   }  &nbsp ; Public String Getrealname () {        return realname;   }       &N Bsp public void Setmangername (String mangername) {        this.mangername = mangername;   }&NBsp   Public String Getmangername () {        return mangername;   }    &nbs p;    public void Setrolename (String rolename) {        This.rolename = rolename;  &nbs P }    Public String getrolename () {        return rolename;   }          public void Setappmodule (String appmodule) {        This.appmodule = APPMODULE;&NB Sp  }    Public String getappmodule () {        return appmodule;   }  &NB sp;      public void Setproject (list<project> Project) {        This.project = project;   }    public list<project> getproject () {        R Eturn project;   }         public void SetError (String error) {    &NBS P   This.error = Error;   }    public String geterror () {        return error;   }         public void setmsg (String msg) {        this.msg = msg;    }    Public String getmsg () {        return msg;   }    } +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +Package Com.duowan.tool;import Org.codehaus.jackson.annotate.jsonignoreproperties;import org.codehaus.jackson.annotate.jsonproperty;    public class Project {    @ Jsonproperty ("BUGUIDLV1")    private String buguidlv1;    @JsonProperty ("Projguid")     private string projguid;    @JsonProperty ("Buguid")    private string buguid;   @ Jsonproperty ("ProjName")    private String projname;    @JsonProperty ("Projareaname")    private string projareaname;    @JsonProperty ("Salegroupid")    private string salegroupid;     @JsonProperty ("Salename")    private String salename;    @JsonProperty ("Isleader")    private string isleader;      public void SetBuguidlv1 (string buguidlv1) {        THIS.BUGUIDLV1 = buguidlv1;   }    public String getBuguidlv1 () {      & NBsP return buguidlv1;   }         public void Setprojguid (String projguid) {  & nbsp     This.projguid = projguid;   }    public String getprojguid () {      &NBS P return projguid;   }         public void Setbuguid (String buguid) {        This.buguid = buguid;   }    public String getbuguid () {        RE Turn buguid;   }         public void Setprojname (String projname) {        This.projname = projname;   }    public String getprojname () {      &NB Sp return projname;   }         public void Setprojareaname (String projareaname) {         This.projareaname = projareaname;   }    public String getprojareaname () {        return projareaname;   }         public void Setsalegroupid ( String salegroupid) {        this.salegroupid = salegroupid;   }    public String Getsalegroupid () {        return salegroupid;   }         PU Blic void Setsalename (String salename) {        this.salename = salename;   }    Public String Getsalename () {        return salename;   }       &N Bsp public void Setisleader (String isleader) {        This.isleader = isleader;   }  &nbsp ; Public String Getisleader () {        return isleader;   }    }

Original address: http://www.cnblogs.com/earl-yongchang/p/4929420.html

Write JavaBean based on JSON data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.