Java object Go JSON property is empty

Source: Internet
Author: User

Java object to JSON property is empty, check whether the property in the class has a standard get and set method

For example:

Public class example implements Serializable {
Public String EntityName;

Public String DataSourceName;

Public String Entityvarname;

Public String pcchname;

Public String Pcname;

public list<dbcolumn> columns;

}

Jsonobject obj = Jsonobject.formobject (example);//obj is empty

Check found that the get and set methods are not added in example

Modified Example:

Public class example implements Serializable {
Public String EntityName;

Public String DataSourceName;

Public String Entityvarname;

Public String pcchname;

Public String Pcname;

public list<dbcolumn> columns;


Public String Getentityname () {
return entityname;
}


public void Setentityname (String entityname) {
This.entityname = EntityName;
}


Public String Getdatasourcename () {
return datasourcename;
}


public void Setdatasourcename (String datasourcename) {
This.datasourcename = DataSourceName;
}


Public String Getentityvarname () {
return entityvarname;
}


public void Setentityvarname (String entityvarname) {
This.entityvarname = Entityvarname;
}


Public String Getpcchname () {
return pcchname;
}


public void Setpcchname (String pcchname) {
This.pcchname = Pcchname;
}


Public String Getpcname () {
return pcname;
}


public void Setpcname (String pcname) {
This.pcname = Pcname;
}


Public list<dbcolumn> GetColumns () {
return columns;
}


public void SetColumns (list<dbcolumn> columns) {
this.columns = columns;
}
}

Java object Go JSON property is empty

Related Article

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.