Skip to content

Instantly share code, notes, and snippets.

@msomu
Last active August 29, 2015 14:07
Show Gist options
  • Save msomu/a558952f1a14b5fbe69a to your computer and use it in GitHub Desktop.
Save msomu/a558952f1a14b5fbe69a to your computer and use it in GitHub Desktop.
JSON Array Parsing in android
try {
JSONArray flimsJSON = new JSONArray(s);
int numVideos = flimsJSON.length();
for(int i =0; i<numVideos;i++){
JSONObject titleJSON = (JSONObject) flimsJSON.get(i);
String titleString = titleJSON.getString("title");
Log.d("TITLE:",titleString);
}
Log.d("Number of MOVIES FETCHED","is"+numVideos);
} catch (JSONException e) {
Log.e("Error","ALL ERROR");
}
[
{
id: "170",
yid: "6O1wXJBlN6A",
userid: "15",
vpath: "",
title: "Sainma",
url: "",
descr: "In a small sleepy town, trouble is brewing. Our ordinary looking hero Ramu aided by his faithful sidekick Galeez, fail in their masteplan to elope with Ramu's sweetheart Ramula ( for the third time).",
email: "",
direction: "",
story: "",
camera: "",
lang: "tamil",
cate: "",
genre: "love",
views: "0",
duration: "00:26:13",
status: "1",
type: "1"
},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment