{
"retCode": 0,
"retInfo": "Success",
"order": {
"Id": 10001233,
"steps": [
[
{
"Index": 0,
"modal": "312",
"time": "42"
}
],
[
{
"Index": 1,
"modal": "321",
"time": "7"
}
]
]
}
}
以上是我得到的一个借口的返回数据,请问用JsonModel解析的话,应该如何写?
迷茫2017-04-18 09:54:02
{
"Index": 1,
"modal": "321",
"time": "7"
}
The above is written with an entity class such as AObeject,
@property (nonatomic, strong) NSArray <AObeject> ; *steps;
伊谢尔伦2017-04-18 09:54:02
//手写的,可能有拼写错误
// 基类
@interface ModelLayer00 : JSONModel
@property (assign, nonatomic) NSInteger retCode;
@property (strong, nonatomic) NSString *retInfo;
@end
//.h
@protocal ModelLayer22;
//第一层
@interface ModelLayer11 : ModelLayer00
@property (assign, nonatomic) NSInteger Id;
@property (strong, nonatomic) NSArray<ModelLayer22> *steps;
@end
@interface ModelLayer22 : JSONModel
@property (assign, nonatomic) NSInteger Index;
@property (strong, nonatomic) NSString *modal;
@property (strong, nonatomic) NSString *time;
@end
//.m
@implementation ModelLayer11
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{@"order.Id":@"Id",@"order.steps":@"steps"}];
}
@end
@implementation ModelLayer22
@end
怪我咯2017-04-18 09:54:02
http://www.jianshu.com/p/3cce...
JSONModel author’s article
It is recommended to read more official documents after connecting to the third-party service, some questions will be answered