Parsing array with objects of different subclasses
shmueldw opened this issue · comments
shmueldw commented
Hi.
I need to parse JSON array like this:
[
{
"time": "1",
"type" : "a",
"custom_field_a": "avalue"
},
{
"time": "2",
"type" : "b",
"custom_field_b": "bvalue"
}
]
@interface BaseClass : MTLModel
@Property (nonatomic, readonly) NSString time;
@Property (nonatomic, readonly) NSString type;
@interface ClassA : BaseClass
@Property (nonatomic, readonly) NSString customFieldA;
@interface ClassB : BaseClass
@Property (nonatomic, readonly) NSString customFieldB;
So I am not sure how can I parse. Could you help me?