JSONArray and JSONObject for google calendar
I am trying to create an android app to read the information from google calender using the json output.
http://www.google.com/calendar/feeds/developer-calendar@google.com/public/full?alt=json
Can anyone tell me how I can accomplish this using JSONArray开发者_JS百科 and JSONObject options available in android sdk.
Greatly appreciate any help on this...
Thanks in advance...
Here's an example
// Query the API for content
String content = getUrlContent(String.format(WIKTIONARY_PAGE,
encodedTitle, expandClause));
try {
// Drill into the JSON response to find the content body
JSONObject response = new JSONObject(content);
JSONObject query = response.getJSONObject("query");
JSONObject pages = query.getJSONObject("pages");
JSONObject page = pages.getJSONObject((String) pages.keys().next());
JSONArray revisions = page.getJSONArray("revisions");
JSONObject revision = revisions.getJSONObject(0);
return revision.getString("*");
} catch (JSONException e) {
throw new ParseException("Problem parsing API response", e);
}
精彩评论