I am trying to parse json values into my Android application. Here i am stuck at a place wherein I need to have the objects length inside the json arraylist.
Below is my json:
"events": { //json object
"2012-11-30": [ // json array
{
"privacy": "OPEN",
"name": "LOGDGE"
}
],
"2013-08-17": [
{
"privacy": "OPEN",
"name": "Party: Dinner and Dancing"
}
],
"2013-09-14": [
{
"privacy": "OPEN",
"name": "Party: Dinner and Dancing"
}
],
"2013-09-27": [
{
"privacy": "OPEN",
"name": "Salsa Party!"
}
{
"privacy": "OPEN",
"name": "Dance Performance Course",
}
],
"2013-10-23": [
{
"privacy": "OPEN",
"name": "Dance Performance Course"
}
]
}
Now my question is how do I parse to get the length of the json array like:
- 2012-11-30 count = 1
- 2013-08-17 count = 1
- 2013-09-27 count = 2
How do I loop the json array using the date's as they are json object and find the length of each of the json array dates. I want count of each array individually over here. Would I need to add a key value kind of pair in the json array "dates" so as I can have a for loop to get the count of the values inside the array?
Thank you in advance