Dies ist die json, die ich von einer URLJSONarray zeigt Kein Wert Parsen gefunden
{
responce: "success",
data: [
{
Breakfast: [
{
food_interval: "Breakfast",
id: "1",
menu_creator_id: "1",
item_code: "13",
food_interval_category_id: "1",
food_interval_category: "Main Item",
item_name: "Methi thepal",
item_quantity: "1",
unit_id: "1",
unit_desc: "Number"
},
{
food_interval: "Breakfast",
id: "2",
menu_creator_id: "1",
item_code: "14",
food_interval_category_id: "2",
food_interval_category: "Cereals",
item_name: "Museli",
item_quantity: "1",
unit_id: "7",
unit_desc: "Bowl "
},
{
food_interval: "Breakfast",
id: "3",
menu_creator_id: "1",
item_code: "15",
food_interval_category_id: "8",
food_interval_category: "Bread",
item_name: "Brown Bread",
item_quantity: "2",
unit_id: "1",
unit_desc: "Number"
},
{
food_interval: "Breakfast",
id: "4",
menu_creator_id: "1",
item_code: "16",
food_interval_category_id: "21",
food_interval_category: "Butter Cheese",
item_name: "Cheddar Cheese",
item_quantity: "1",
unit_id: "3",
unit_desc: "Gram"
}
]
}
]
}
-Code ich versucht habe ich immer:
String result = response.body().string();
JSONObject jsonObject = new JSONObject(result);
JSONArray foodintervalarray = jsonObject.getJSONArray("data");
for(int i = 0 ; i < foodintervalarray.length(); i++){
JSONObject jsonObject1 = foodintervalarray.getJSONObject(i);
JSONArray breakfast = jsonObject1.getJSONArray("Breakfast");
for(int j = 0 ; j < breakfast.length(); j++){
JSONObject jsonObject2 = breakfast.getJSONObject(j);
String breakFastMenu = jsonObject2.getString("food_interval");
Log.i("breakFastMenu","breakFastMenu "+breakFastMenu);
}
Aber ich bin immer: für Frühstück Array Kein Wert . Nach dem Datenarray gibt es ein {, also muss ich JsonObject aufrufen, bevor ich JsonArray zum Frühstück anrufe? Kann mir jemand vorschlagen, was
Dank tun
http://dieto.vm1.in/api/menu_display_2d.php?date=2016/08/22&diet_type=6&food_category=1&class_type=1 , wenn ich es in jsonlint testen, zeigt es mir richtig, es auch sagt gültig, aber in meinem Browser zeigt es anders, warum? –
Das ist richtig json.w8 ein bisschen. Ich werde überprüfen. – Vyacheslav
@narahari_arjun, aktualisiert. Überprüfen Sie, wie Sie Ihre JSON-Daten abrufen. Ist es richtig. – Vyacheslav