【发布时间】:2014-08-27 21:07:55
【问题描述】:
我有一个如下的 JSON 字符串
[["Exampe_Level0_1","Exampe_Level1_1","Exampe_Level2_1","Exampe_Level3_1","Exampe_Level4_1","Exampe_Level5_1"],["Exampe_Level0_2","Exampe_Level1_2","Exampe_Level2_2","Exampe_Level3_2","Exampe_Level4_2","Exampe_Level5_2"]]
我也有一堂课
ExampleClass.h
#import <Foundation/Foundation.h>
@interface ExampleClass : NSObject
@property(nonatomic, strong)NSString *Level0;
@property(nonatomic, strong)NSString *Level1;
@property(nonatomic, strong)NSString *Level2;
@property(nonatomic, strong)NSString *Level3;
@property(nonatomic, strong)NSString *Level4;
@property(nonatomic, strong)NSString *Level5;
@end
显然在JSON字符串中,数组中的第一项是ExampleClass Level0,数组中的第二项是ExampleClass Level1等等。
理想情况下,我想将 JSON 数据转换为 NSMutableArray 到 NSDictionary 的格式。我只是迷失了如何转换它。
谢谢
【问题讨论】:
-
NSJSONSerialization.
-
@user3521174 你从哪里得到问题中的 JSON?
标签: objective-c json