Here's my JSON data
[{
"id": 1,
"name":"Soup",
"price":200,
"isOK":1
},
{
"id": 2,
"name":"Salad",
"price":100,
"isOK":0
}]
I have created JSONModel as follows
@interface ProductModel : JSONModel
@property (assign, nonatomic) int id;
@property (strong, nonatomic) NSString* name;
@property (assign, nonatomic) float price;
@property (assign, nonatomic) BOOL isOK;
@end
Next,
NSArray* modelsArray = [ProductModel arrayOfModelsFromDictionaries:objects];
Now what I want is
if(isOK)
{
// then add the model into the modelsArray
} else {
// then don't add the model into the modelsArray
}
Is it possible to write this logic somewhere within the model file, without iterating the modelsArray and then removing the objects one by one on the basis of isOK ?