desaikush210 / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

How to access multiple dimenation json array string value #533

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi

Can any one help me to parse the multiple dimenational json array string.
My json string as below

{'result':{'jan8ignite':{'_id':'4e4b63e11d330000000051c8','website':{'websiteId'
:'40','websiteName':'stagingwb.opencloudapi.com','website_style':'1_Column'},'co
mpanyLogo':'','companyLogoWebsite':'','formEmailAddress':'ajay.vskm@gmail.com'}}
}

I want to get the websiteName from the above string, so i can achive this.

Please reply me ASAP.

Thanks

Original issue reported on code.google.com by rajubish...@gmail.com on 29 Aug 2013 at 12:38

GoogleCodeExporter commented 9 years ago
class Response {
  Map<String, User> result;
}
class User {
  String _id;
  Website website;
  String companyLogo;
  String companyLogoWebsite;
  String formEmailAddress;
}
class Website {
  String websiteId;
  String websiteName;
  String website_style;
}

Deserialize the JSON as a Response.class. Then you can get the user from the 
result Map and call user.website.websiteName to get the value.

Original comment by j...@squareup.com on 9 Aug 2014 at 6:09