Step by step I'm getting closer. My api from instagram get read out in the run section when I check it, but then in the end it says: at data of type org.json.JSONObject cannot be converted to JSONArray
Anyone what is going wrong?
If someone can help me with this, I would be really gratefull because I'm new to api reading and I'm also building an app where the data would be loaded in a gridview probably with the retrofit library.
This is one of the biggest threshold right now that is holding me back to contineu with my app building.
buttonParse.setonclickListener(new View.onclickListener() { @Override public void onclick(View v) { jsonParse(); } }); private void jsonParse() { String url = "https://api.instagram.com/v1/users/self/?access_token=2086453534.15c5d2e.8a4c8d77992444459faf6e7f98005a4e\n"; JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { try { JSONArray jsonArray = response.getJSONArray("data"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject data = jsonArray.getJSONObject(i); String firstName = data.getString("id"); String username = data.getString("username"); String profile_picture = data.getString("profile_picture"); mTextViewResult.append(firstName + ", " + username + ", " + profile_picture + "\n\n"); } } catch (JSONException e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onerrorResponse(VolleyError error) { error.printStackTrace(); } }); mQueue.add(request); }