java - JSON object within object -
this question has answer here:
- how parse json in java 27 answers
"fid": "123", "farm_info": { "name": "example farm", "address": "example address", "phone": "111-111-1111", "web": "" }, "personal_info": { "name": "myname", "email": "myname@example.com", "phone": "111-111-0000" }, "delivers_to": ["60001", "60002"]
this object returned json. in java fid string , delivers_to array of strings. data type farm_info , personal_info have json returned?
a class
custom defined data type in java (you can define group of elements structure in c) , so, farm_info , personal_info object
types.
so parse json, along data types mentioned, need below custom defined datatypes (java classes).
public class farminfo { private string name; private string address; private string phone; private string ;web //getter , setter methods need generated } public class personalinfo { private string name; private string email; private string phone; //getter , setter methods need generated }
you can refer here more classes , objects.
also, refer here understanding json parsing.
Comments
Post a Comment