Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing JSON values inside an array android
    primarykey
    data
    text
    <p>this the JSON data that i want to parse in my application:</p> <pre><code>{ "viewdeal":[ { "viewdeal1":{ "teetimeId":"33", "golfcourseId":"127", "offers":"descount of $2", "time":"8\/7\/pm", "amount":"90", "month":"august", "year":"2012", "date":"21", "day":"monday", "created_date":"0", "golfcourse_name":"SilverHorn Golf Club" }, "msz":"Book" } ] } </code></pre> <p>The code that i am using to parse the JSON data is:</p> <pre><code>JsonParser jParser = new JsonParser(); JSONObject json = jParser.getJSONfromUrl("http://mygogolfteetime.com/iphone/viewdeal/127"); JSONArray viewdeal = json.getJSONArray(TAG_VWDL); vwdlsList.clear(); for(int i=0; i&lt;viewdeal.length(); i++) { JSONObject v1 = viewdeal.getJSONObject(i); msz = v1.getString(TAG_MSZ); viewdeal1 = v1.getString(TAG_VWDL1); JSONArray viewdeal1 = json.getJSONArray(TAG_VWDL1); for(int j=0; j&lt;viewdeal1.length(); j++) { JSONObject v2 = viewdeal.getJSONObject(j); teetimeId = v2.getString(TAG_TTIMEID); golfcourseId = v2.getString(TAG_GLFCRSID); offers = v2.getString(TAG_OFR); time = v2.getString(TAG_TIME); amount = v2.getString(TAG_AMNT); month = v2.getString(TAG_MNTH); year = v2.getString(TAG_YEAR); date = v2.getString(TAG_DATE); day = v2.getString(TAG_DAY); created_date = v2.getString(TAG_CRTDATE); golfcourse_name = v2.getString(TAG_GLFCRSNAME); } HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map.put(TAG_TTIMEID, teetimeId); map.put(TAG_GLFCRSID, golfcourseId); map.put(TAG_MSZ, msz); map.put(TAG_OFR, offers); map.put(TAG_TIME, time); map.put(TAG_AMNT, amount); map.put(TAG_MNTH, month); map.put(TAG_YEAR, year); map.put(TAG_DATE, date); map.put(TAG_DAY, day); map.put(TAG_CRTDATE, created_date); map.put(TAG_GLFCRSNAME, golfcourse_name); vwdlsList.add(map); } } </code></pre> <p>In the above code i am able to parse the value of msz and viewdeal1 but when i try to parse the remaining values that are in the viewdeal1 i receive the following message in my LogCat:</p> <pre><code>08-22 12:03:46.034: V/GoGolf(1178): org.json.JSONException: No value for viewdeal1 </code></pre> <p>How can I parse the remaining values that are in the viewdeal1..</p> <p>Thanks in advance..</p>
    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.
    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