Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your JSON Object fields need to be encapsulated by quotes</p> <p>IE</p> <pre><code>{ "code": "BOAC", "cours_jour": "29 000", "variation": "-1.69" } </code></pre> <p>How was the JSON file generated?</p> <p>--Edit</p> <p>You can use the below code to download the page to a string and then convert it to a JSONArray and then pull each JSONObject. You cannot run any web requests on the main thread so either extend a new asynctask or thread or runnable to perform the below</p> <pre><code>DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httpost = new HttpPost("http://www.impaxis-securities.com/securities/cours-actions/cours.json"); httpost.setHeader("Accept", "application/json"); httpost.setHeader("Content-type", "application/json"); ResponseHandler&lt;String&gt; responseHandler = new BasicResponseHandler(); String response; try { response = httpclient.execute(httpost, responseHandler); JSONArray arr = new JSONArray(response); int arrLength = arr.length(); if(arrLength &gt; 0) { for(int i = 0; i &lt; arrLength; i++) { JSONObject item = arr.getJSONObject(i); String code = item.getString("code"); String cours_jour = item.getString("cours_jour"); String variation = item.getString("variation"); //Either insert to a DB or add to an array list and return it } } } catch (ClientProtocolException e) { //Issue with web server } catch (IOException e) { //Issue with request } catch (JSONException e) { //ISSUE Parsing JSON from site } </code></pre> <p>---Edit</p> <p>I tested the code and it looks like there is a bug with the JSON plugin/REST service</p> <p><a href="http://drupal.org/node/1433436" rel="nofollow">http://drupal.org/node/1433436</a></p>
 

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