I am getting JSON response like this :
{
"partner_wise": {
“partner1”: {
"processing": 254,
"complete": 0,
"track_invoice": 0,
"bar_code": 0
},
"": {
"processing": 0,
"complete": 0,
"track_invoice": 0,
"bar_code": 0
},
"partner2": {
"processing": 0,
"complete": 0,
"track_invoice": 0,
"bar_code": 0
}
}
}
I am setting these values indexwise in tableView. From this JSON Response I didn't have to show the value for which key is empty string. How can I delete this object from NSDictionary.
You can't delete these objects from NSDictionary. NSDictionary is a immutable object.
But you can make a mutable copy and remove unneeded keys:
//remove from mutable dictionary
NSDictionary* dictionary = [self getData];
NSMutableDictionary* mutableDictionary = [dictionary mutableCopy];
[mutableDictionary removeObjectForKey:@""];
self.data = mutableDictionary;