java - To form Json from nested POJOS -
java - To form Json from nested POJOS -
i have nested pojo below. pojo's in same package. please see pupil is name pojo , other pojo inside
class student{ string firstname; string lastname; list <activities> activites; public string getfirstname() { homecoming firstname; } public void setfirstname(string firstname) { this.firstname = firstname; } public string getlastname() { homecoming lastname; } public void setlastname(string lastname) { this.lastname = lastname; } public list<activities> getactivites() { homecoming activites; } public void setactivites(list<activities> activites) { this.activites = activites; } } class activites{ list<quipments> quipments; string time; public list<quipments> getquipments() { homecoming quipments; } public void setquipments(list<quipments> quipments) { this.quipments = quipments; } public string gettime() { homecoming time; } public void settime(string time) { this.time = time; } } class quipments{ string type; public string gettype() { homecoming type; } public void settype(string type) { type = type; } }
i want convert above pupil pojo in json have values of other pojo.
we not suppose utilize below api. know below 1 works.
import com.sun.jersey.api.json.jsonjaxbcontext; import com.sun.jersey.api.json.jsonmarshaller;
want utilize below
import org.json.simple.jsonarray; import org.json.simple.jsonobject; import org.json.simple.jsonvalue;
please advice
java json pojo
Comments
Post a Comment