If I have a JSON array like this,
{
"list": [
"javascript",
"stockFields",
"stockLists"
]
}
and two models like:
@interface stockList : MTLModel <MTLJSONSerializing>
@property(nonatomic, copy, readonly) NSArray *stockListItems;
@end
@interface stockListItem : MTLModel
@property(nonatomic, copy, readonly) NSString *javascript;
@property(nonatomic, copy, readonly) NSString *stockFields;
@property(nonatomic, copy, readonly) NSString *stockLists;
@end
stockList.m
+ (NSDictionary*)JSONKeyPathsByPropertyKey {
return @{
@"stockListItems":@"list",
};
}
+ (NSValueTransformer *)stockLstItemsJSONTransformer {
}
How to parse JSON list array attribute storage stockListItem's properyty ?thanks a lot!
You just set them by index if you are sure the indexes are:
Otherwise, you could have another
Dictionary
inlist
to get exact data you want, just like:and now:
Hope this could help.