I have tried to parse that JSON string and I got one solution please try this also:
String parse = "[{\"hotelid\":[{\"hotelid\":\"1\",\"name\":\"aaa\",\"code\":\"111\",\"price\":\"111\"},{\"hotelid\":\"2\",\"name\":\"bbb\",\"code\":\"112\",\"price\":\"211\"},{\"hotelid\":\"4\",\"name\":\"ccc\",\"code\":\"42\",\"price\":\"411\"}]}]";
try {
JSONArray menuObject = new JSONArray(parse);
for(int i=0;i<menuObject.length();i++){
String hotel = menuObject.getJSONObject(i).getString("hotelid").toString();
System.out.println("hotel="+hotel);
JSONArray menuObject1 = new JSONArray(hotel);
for(int j=0; j<menuObject1.length();j++){
String hotelid = menuObject1.getJSONObject(j).getString("hotelid").toString();
System.out.println("hotelid=="+hotelid);
String name = menuObject1.getJSONObject(j).getString("name").toString();
System.out.println("name=="+name);
String code = menuObject1.getJSONObject(j).getString("code").toString();
System.out.println("code=="+code);
String price = menuObject1.getJSONObject(j).getString("price").toString();
System.out.println("price=="+price);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
solved Android JSON parse this, how?