[
{
"name": "The Universe & The Earth"
, "imagename": "cat1.jpg"
, "active": "Y"
, "createdon": "1901-01-01"
, "lastmodifiedon": "1901-01-01 00:00:00"
, "description": "Knowledge of Earth location in the universe has been shaped by 400 years of telescopic observations, and has expanded radically in the last century.\n"
, "id": "1"
}
, {
"name": "Life on Earth"
, "imagename": "cat2.jpg"
, "active": "Y"
, "createdon": "1901-01-01"
, "lastmodifiedon": "1901-01-01 00:00:00"
, "description": "Over the last 3.7 billion years or so, living organisms on the Earth have diversified and adapted to almost every environment imaginable."
, "id": "2"
}
]
This is my json values. Now i want to parse and displayed in custom list view how can i do this? I followed http://www.androidhive.info/2012/01/android-json-parsing-tutorial/ this is link but can't be achieve. How can i do this? Can anybody tell me? Thanks in advance.
Check out GSON by Google. It lets you serialize/deserialize JSON in a super easy way - http://code.google.com/p/google-gson/
This is a JSONArray and not a JSONObject - to make a JSONObject from it, use
this gets the first JSONObject from this JSONArray.
If you have multiple JSONObjects, use this:
To get the values:
Try following code.
You can simply use Map to iterate through all the keys and values of JSONObject,
First I created parser class JSONParser.java
Then create an object in main class like this....
I did by this way. I got the proper output. All the best.