Java has his own JSON parser: we can use it on Android as well.
Below you can find how you can get all events from your String.
String TAG = "JSON EXAMPLE";
String jsonString = "{\"Events\" : [{\"name\" : \"exp\",\"date\" : \"10-10-2010\",\"tags\" : [\"tag 1\",\"tag 2\",\"tag 3\"]}],\"Contacts\" : [{\"name\" : \"John Smith\",\"date\" : \"10-10-2010\",\"tags\" : [\"tag 1\",\"tag 2\",\"tag 3\"]}]}";
try {
JSONObject jsonObj = new JSONObject(jsonString); // create a json object from a string
JSONArray jsonEvents = jsonObj.getJSONArray("Events"); // get all events as json objects from Events array
for(int i = 0; i < jsonEvents.length(); i++){
JSONObject event = jsonEvents.getJSONObject(i); // create a single event jsonObject
Log.e(TAG, "Event name:" + event.getString("name") + " date: " + event.getString("date"));
JSONArray eventTags = event.getJSONArray("tags");
for(int j = 0; j < eventTags.length(); j++){
Log.e(TAG, "Event tag: " + eventTags.getString(j));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
Be aware: Your JSON Object(from your question) will throw a exception because it is not valid( I'm not sure, but it look like a javascript object). You have to add some quotes to each property(key) and ecape them with \ (\").
This tool is really nice to test if a JSON String is valid or not.