//  ProductModel.h
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import "JSONModel.h" @interface ProductModel : JSONModel @property (nonatomic,strong)NSString<Optional> * id1;
@property (nonatomic,strong)NSString<Optional> * name;
@property (nonatomic,strong)NSString<Optional> * price; @end // ProductModel.m
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import "ProductModel.h" @implementation ProductModel
+(JSONKeyMapper *)keyMapper{
return [[JSONKeyMapper alloc] initWithDictionary:@{@"id":@"id1",@"sss":@"xxxxx"}];
}
@end
//  test1Model.h
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import "JSONModel.h" @protocol test2Model
@end @interface test2Model : JSONModel
@property (nonatomic,strong)NSString<Optional> * id1;
@property (nonatomic,strong)NSString<Optional> * name;
@property (nonatomic,strong)NSString<Optional> * price;
@end @interface test1Model : JSONModel
@property (nonatomic,strong)NSString<Optional> * order_id;
@property (nonatomic,strong)NSString<Optional> * total_price;
@property (nonatomic,strong)NSArray<test2Model,Optional> * product;
@end // test1Model.m
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import "test1Model.h" @implementation test2Model +(JSONKeyMapper *)keyMapper{
return [[JSONKeyMapper alloc] initWithDictionary:@{@"id":@"id1"}];
} @end @implementation test1Model @end
//  ViewController.h
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end //
// ViewController.m
// JSONModel
//
// Created by 张国锋 on 15/7/20.
// Copyright (c) 2015年 张国锋. All rights reserved.
// #import "ViewController.h"
#import "test1Model.h"
@interface ViewController () @end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad];
NSDictionary *dic=[[NSDictionary alloc]init];
test1Model *model=[[test1Model alloc]initWithDictionary:dic error:nil];
/*
@property (nonatomic,strong)NSString<Optional> * order_id;
@property (nonatomic,strong)NSString<Optional> * total_price;
@property (nonatomic,strong)NSArray<test2Model,Optional> * product;
*/
// Do any additional setup after loading the view, typically from a nib.
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

最新文章

  1. python之路-Day5
  2. 发布的时候Archive灰色
  3. linux 正则表达式深度解析
  4. windows 下 文件属性及目录列表操作
  5. iOS: 学习笔记实例, 用代码控制视图创建与切换
  6. myqltransactionRollbackexception deadlock found when trying to get lock
  7. Visual Studio express
  8. 状压DP小结
  9. HTML学习笔记 w3sCss盒子模型应用案例(div布局) 第十一节 (原创) 参考使用表
  10. transfer-webpack-plugin最简使用示例
  11. C++对象模型的那些事儿之三:默认构造函数
  12. Linux调整日期时间
  13. ionic提示弹框
  14. ES学习
  15. thrift 安装历程
  16. maven 入门 (二)
  17. Spring 属性注入(四)属性键值对 - PropertyValue
  18. MEF程序设计指南
  19. 洛谷 P1762 偶数
  20. java编码-多重(正常)

热门文章

  1. BZOJ_2957_楼房重建_线段树
  2. UOJ_14_【UER #1】DZY Loves Graph_并查集
  3. Jasper-template
  4. Python 同ip网站查询(制作网站接口)
  5. 集成hibernateDaoSupport实现增删改查
  6. CF-845B
  7. struts2+jquery+easyui+datagrid+j…
  8. 2-1 本章作业&amp;2-2 开发系统与工具选择
  9. matlab新手入门(一)(翻译)
  10. 使用CTE生成辅助表(数字或时间)等