Ich bin mit dem Flickr-API meine App bekommen Bilder angezeigt werden, je nach Benutzersuche. Ich erhalte diese Fehlermeldung: JSONException: No value for photo
JSONException: Kein Wert für Foto
Der Aufruf das Foto zu bekommen:
public ArrayList<Category> processResults(Response response) {
ArrayList<Category> categories = new ArrayList<>();
try {
String jsonData = response.body().string();
if (response.isSuccessful()) {
JSONObject flickrJSON = new JSONObject(jsonData);
//json data
JSONArray photoJSON = flickrJSON.getJSONArray("photo");
}
}
}
JSON-Format ist dies:
{
photos: { page: 1,
pages: 2165,
perpage: 100,
total: "216413",
photo: [ { id: "37095719122",
....
}
}
JSON-Format diese Fotos ist: { Seite: 1, Seiten: 2165, perpage: 100, gesamt: „216413 ", Foto: [ { ID:" 37095719122 ", – grace
Da' neue JSONObject() 'akzeptiert die Zeichenfolge, ich rate es ein gültiges JSON-Objekt und in diesem Fall sollte die Zeichenfolge mit' {'und nicht beginnen mit 'Fotos'. – ZeekHuge