Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Api Parsing in json
    primarykey
    data
    text
    <p>How can I parse this URL in JSON format?</p> <p><a href="https://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=&amp;rsz=8" rel="nofollow">https://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=&amp;rsz=8</a>"</p> <pre><code>public class MainActivity extends ListActivity { private Context context; private static String url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q=pixelloid&amp;rsz=8"; private static final String TAG_VTYPE = "responseData"; private static final String TAG_VCOLOR = "results"; private static final String TAG_FUEL = "GsearchResultClass"; private static final String TAG_TREAD = "url"; private static final String TAG_OPERATOR = "url"; private static final String TAG_NAME = "name"; private static final String TAG_POINTS = "experiencePoints"; ArrayList&lt;HashMap&lt;String, String&gt;&gt; jsonlist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); ListView lv ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new ProgressTask(MainActivity.this).execute(); } private class ProgressTask extends AsyncTask&lt;String, Void, Boolean&gt; { private ProgressDialog dialog; private ListActivity activity; // private List&lt;Message&gt; messages; public ProgressTask(ListActivity activity) { this.activity = activity; context = activity; dialog = new ProgressDialog(context); } /** progress dialog to show user that the backup is processing. */ /** application context. */ private Context context; protected void onPreExecute() { this.dialog.setMessage("Progress start"); this.dialog.show(); } @Override protected void onPostExecute(final Boolean success) { if (dialog.isShowing()) { dialog.dismiss(); } ListAdapter adapter = new SimpleAdapter(context, jsonlist, R.layout.list_item, new String[] { TAG_VTYPE, TAG_VCOLOR, TAG_FUEL, TAG_TREAD }, new int[] { R.id.vehicleType, R.id.vehicleColor, R.id.fuel, R.id.treadType }); setListAdapter(adapter); // selecting single ListView item lv = getListView(); } protected Boolean doInBackground(final String... args) { JSONParser jParser = new JSONParser(); // getting JSON string from URL JSONArray json = jParser.getJSONFromUrl(url); if (json == null) { // notify user Log.e("==&gt;", "Failed to download file"); } else { for (int i = 0; i &lt; json.length(); i++) { try { JSONObject c = json.getJSONObject(i); String vtype = c.getString(TAG_VTYPE); String vcolor = c.getString(TAG_VCOLOR); String vfuel = c.getString(TAG_FUEL); String vtread = c.getString(TAG_TREAD); HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); // adding each child node to HashMap key =&gt; value map.put(TAG_VTYPE, vtype); map.put(TAG_VCOLOR, vcolor); map.put(TAG_FUEL, vfuel); map.put(TAG_TREAD, vtread); jsonlist.add(map); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); Log.e("==&gt;", "iyogbr;g;ui"); } } } return null; } } } </code></pre> <p>I'm parsing this data:</p> <pre><code>{"responseData":{"results":[{"content":"&lt;b&gt;Pixelloid&lt;\/b&gt; Studios Visual Effects, 3D Animation Production and Training Institute.","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid - Visual Effects, 3D Animation - Production and Training","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; - Visual Effects, 3D Animation - Production and Training","cacheUrl":"http:\/\/www.google.com\/search?q=cache:Uq3_USWdbwIJ:www.pixelloid.com","unescapedUrl":"http:\/\/www.pixelloid.com\/","url":"http:\/\/www.pixelloid.com\/","visibleUrl":"www.pixelloid.com"},{"content":"Pixelloid Studios Visual Effects, 3D Animation Production and Training &lt;b&gt;...&lt;\/b&gt;","GsearchResultClass":"GwebSearch","titleNoFormatting":"Production and Training Institute - Pixelloid","title":"Production and Training Institute - &lt;b&gt;Pixelloid&lt;\/b&gt;","cacheUrl":"http:\/\/www.google.com\/search?q=cache:Pce2UIgSVDoJ:www.pixelloid.com","unescapedUrl":"http:\/\/www.pixelloid.com\/training\/","url":"http:\/\/www.pixelloid.com\/training\/","visibleUrl":"www.pixelloid.com"},{"content":"&lt;b&gt;Pixelloid&lt;\/b&gt; is an award winning 3D Animation &amp;amp; Visual Effects Production and Training Studio based in Hyderabad with branches in Bangalore, Visakhapatnam  &lt;b&gt;...&lt;\/b&gt;","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid Studios - YouTube","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; Studios - YouTube","cacheUrl":"http:\/\/www.google.com\/search?q=cache:wrfWBrpn45AJ:www.youtube.com","unescapedUrl":"http:\/\/www.youtube.com\/user\/pixelloid","url":"http:\/\/www.youtube.com\/user\/pixelloid","visibleUrl":"www.youtube.com"},{"content":"&lt;b&gt;Pixelloid&lt;\/b&gt;, Hyderabad, India. 5896 likes · 60 talking about this · 408 were here. We help people tell their stories effectively. We do animation, visual effects for &lt;b&gt;...&lt;\/b&gt;","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid - Hyderabad, India - Media\/News\/Publishing | Facebook","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; - Hyderabad, India - Media\/News\/Publishing | Facebook","cacheUrl":"http:\/\/www.google.com\/search?q=cache:_m-PNJ9c3sgJ:www.facebook.com","unescapedUrl":"https:\/\/www.facebook.com\/Pixelloid","url":"https:\/\/www.facebook.com\/Pixelloid","visibleUrl":"www.facebook.com"},{"content":"Welcome to the company profile of &lt;b&gt;Pixelloid&lt;\/b&gt; Studios Private Limited on LinkedIn. &lt;b&gt;Pixelloid&lt;\/b&gt; is an award winning Content Creation Company with an active &lt;b&gt;...&lt;\/b&gt;","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid Studios Private Limited | LinkedIn","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; Studios Private Limited | LinkedIn","cacheUrl":"http:\/\/www.google.com\/search?q=cache:vnyg3sUrGfgJ:www.linkedin.com","unescapedUrl":"http:\/\/www.linkedin.com\/company\/pixelloid-studios-private-limited","url":"http:\/\/www.linkedin.com\/company\/pixelloid-studios-private-limited","visibleUrl":"www.linkedin.com"},{"content":"The latest from &lt;b&gt;Pixelloid&lt;\/b&gt; (@&lt;b&gt;Pixelloid&lt;\/b&gt;). &lt;b&gt;Pixelloid&lt;\/b&gt; is an award winning 3D Animation &amp;amp; Visual Effects studio with a dedicated commercial training division.","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid (Pixelloid) on Twitter","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; (&lt;b&gt;Pixelloid&lt;\/b&gt;) on Twitter","cacheUrl":"http:\/\/www.google.com\/search?q=cache:s4gJgJcovCsJ:twitter.com","unescapedUrl":"https:\/\/twitter.com\/Pixelloid","url":"https:\/\/twitter.com\/Pixelloid","visibleUrl":"twitter.com"},{"content":"Feb 10, 2013 &lt;b&gt;...&lt;\/b&gt; &lt;b&gt;Pixelloid&lt;\/b&gt;, Hyderabad is the only training institute in India that has an active production environment. &lt;b&gt;Pixelloid&amp;#39;s&lt;\/b&gt; courses are tailored to the &lt;b&gt;...&lt;\/b&gt;","GsearchResultClass":"GwebSearch","titleNoFormatting":"Pixelloid - Admission, Courses, Fee, Address | Pixelloid | Hyderabad ...","title":"&lt;b&gt;Pixelloid&lt;\/b&gt; - Admission, Courses, Fee, Address | &lt;b&gt;Pixelloid&lt;\/b&gt; | Hyderabad &lt;b&gt;...&lt;\/b&gt;","cacheUrl":"http:\/\/www.google.com\/search?q=cache:3OWFak05f30J:www.minglebox.com","unescapedUrl":"http:\/\/www.minglebox.com\/college\/pixelloid-Hyderabad","url":"http:\/\/www.mi </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    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