Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to fetch data of API through JSONArray
    primarykey
    data
    text
    <pre><code>//My API link //http://gdata.youtube.com/feeds/base/videos?max-results=10&amp;start-//index=1&amp;alt=json&amp;orderby=published&amp;author=astrobixweb //String Method to fetech data from server public static String sendRequest(String url) { String result = ""; try { HttpClient client = new DefaultHttpClient(); HttpParams httpParameters = client.getParams(); HttpConnectionParams.setConnectionTimeout(httpParameters, 5000); HttpConnectionParams.setSoTimeout(httpParameters, 5000); HttpConnectionParams.setTcpNoDelay(httpParameters, true); HttpGet request = new HttpGet(); request.setURI(new URI(url)); HttpResponse response = client.execute(request); InputStream ips = response.getEntity().getContent(); BufferedReader buf = new BufferedReader(new InputStreamReader(ips, "UTF-8")); StringBuilder sb = new StringBuilder(); String s; while (true) { s = buf.readLine(); if (s == null || s.length() == 0) break; sb.append(s); } buf.close(); ips.close(); result = sb.toString(); } catch (Exception e) { e.printStackTrace(); } return result; } } //Here is parser class public static void GroupResult(String url){ try{ JSONArray jsonarray,jsonArray1,jsonArray2 ; JSONObject json ; response=GetJsonObject.sendRequest(url); //data comes into response variable if(response == null){ return; } jsonarray = new JSONArray("["+response+"]"); json = jsonarray.getJSONObject(0); String feed = (json.getString("feed")); Log.v("feed", ""+feed); //try{ jsonarray = new JSONArray("["+feed+"]"); json = jsonarray.getJSONObject(0); String entry = json.getString("entry"); jsonarray = new JSONArray(entry); for (int i = 0; i &lt; jsonarray.length(); i++) { mData=new AstrobixData(); json = jsonarray.getJSONObject(i); String title_array = json.getString("title"); jsonArray1 = new JSONArray("["+title_array+"]"); String title = jsonArray1.getJSONObject(0).getString("$t"); String imagepath=json.getString("content"); jsonArray2=new JSONArray("["+imagepath+"]"); String urliamge=jsonArray1.getJSONObject(0).getString("$t"); } // mData.SetTitle(title); // mList.add(mData); } } // Log.v("title", ""+title_list); } } </code></pre> <p>Someone please help to fetch the data of this API link. i have to tried and i have to fetched all data in String variable though http. but i want to 2 things from this API but i am not able to fetch these are:-</p> <ol> <li>title: <code>"Sun,Moon, Mars, Rahu and Jupiter Antardasha during Sun's Mahadasha"</code></li> <li><p>Image: </p> <p><img src="https://i.stack.imgur.com/NdlsN.jpg" alt="image"></p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload