I'm trying to parse this relatively simple JSON array:
{
"tags":[
"Cheese",
"Milk",
"Yoghurt"
],
"success":1,
"message":"Tags found"
}
What I've got is this:
Log.d("Tag products: ", json.toString());
try {
// Checking for SUCCESS TAG
int success = json.getInt("success");
if (success == 1) {
// products found
// Getting Array of Products
JSONArray products = json.getJSONArray("tags");
} else {
// no products found
}
} catch (JSONException e) {
e.printStackTrace();
}
My Array is logged to my logcat perfectly. I'm succesfully retrieving the value of success and message. But I can't parse the actual tags.
Most examples and tutorails about json parsering use another format than I do, so I also would be more than happy with an example that demonstrates the parsing of this kind of array.