Here i need json format like this to send to server how can i do this i have tried so many way but i could not get here is my format:
{"accountModel":[
{
"AddressLine1": "purasai",
"AddressLine2": "otteri",
"AddressLine3": "t nagar",
"CompanyGroup": "yogangroups",
"CompanyName": "yogan inc",
"IsIndividual": 1,
"IsMulitLocation": 1,
"LandLine1": "landline1",
"LandLine2": "Landline2",
"PinCode": "pincode",
"WebSiteContactEmailID": "vbbb",
"WebsiteURL": "ghb",
"company_name_id": 68,
"AccountManagerID": 185,
"CityID": 165,
"IndustryID": 4,
"RegionID": 24,
"StateID": 129
},
{
"AddressLine1": "yoh",
"AddressLine2": "f",
"AddressLine3": "",
"CompanyGroup": "uo",
"CompanyName": "vv",
"IsIndividual": 1,
"IsMulitLocation": 1,
"LandLine1": "landline1",
"LandLine2": "Landline2",
"PinCode": "pincode",
"WebSiteContactEmailID": "yg",
"WebsiteURL": "ff",
"company_name_id": 10,
"AccountManagerID": 185,
"CityID": 165,
"IndustryID": 5,
"RegionID": 24,
"StateID": 126
}
]}
How can i achieve this !! i have used Gson library:
Gson gson=new Gson();
String Json=gson.toJson(listobj);
JSONObject jobj=new JSONObject();
try {
jobj.put("accountModel",Json.toString());
} catch (JSONException e) {
e.printStackTrace();
}
But i could not get Desired Format !!