This is my JSON Response 1 for the time entry Spent_on:"2015-12-27"
{
"A": {
"user": {
"id": 1,
"name": "B"
},
"startday": "2015-12-27",
"status": "New",
"total": 2,
"time_entries": [{
"id": 768,
"project": {
"id": 8,
"name": "C"
},
"user": {
"id": 1,
"name": "B"
},
"activity": {
"id": 8,
"name": "D"
},
"hours": 2,
"comments": "",
"spent_on": "2015-12-27"
}]
}
}
I had created the dictionary format like this to do post operation:
NSDictionary * response =@{@"A": @{@"user": @{@"id": @1,@"name": @"B"},@"startday@": @"2015-12-27",@"status@": @"New",@"total@": 2,@"time_entries@": [{@"id@": 768,@"project@": {@"id@": 8,@"name": @"C"},@"user": {@"id": 1,@"name": @"B"},@"activity": {@"id": 8,@"name": @"D"},@"hours": 2,@"comments": @"",@"spent_on": @"2015-12-27"}]}};
This is my JSON response 2 for time entry Spent_on:"2015-12-27" and "2015-12-28"
{
"A": {
"user": {
"id": 1,
"name": "B"
},
"startday": "2015-12-27",
"status": "New",
"total": 6,
"time_entries": [{
"id": 768,
"project": {
"id": 8,
"name": "C"
},
"user": {
"id": 1,
"name": "B"
},
"activity": {
"id": 8,
"name": "D"
},
"hours": 2,
"comments": "",
"spent_on": "2015-12-27"
}, {
"id": 775,
"project": {
"id": 8,
"name": "C"
},
"user": {
"id": 1,
"name": "B"
},
"activity": {
"id": 8,
"name": "D"
},
"hours": 4,
"comments": "",
"spent_on": "2015-12-28"
}]
}
}
The json response 2 having one more time_entry id,hours,spent_on than json response1.similarly, for every new hours entry for every new date(spent_on).A new time entry id will generate and also Response length will increase.
So, How to create the mutable dictionary or dictionary for above response and also if the different hours and different date will occur(example for one full week).for that how to create dictionary for it?Else any other way to do this.Thanks in advance.
See Question&Answers more detail:
os