How to Analyze JSon Data on the iOS Application


I want to get thumbskind value of data. My codes are as follows:

@property(nonatomic, assign) NSInteger code;
@property(nonatomic, copy) NSString *msg;
@property(nonatomic, copy) NSString *type;
@property(nonatomic, copy) NSString *details;
@property(nonatomic, copy) NSDictionary *data;

 NSDictionary *obj = (NSDictionary *)sender;

self.code = [[obj objectForKey:@"code"] intValue];
self.msg = [obj valueForKeyPath:@"msg"];
self.type = [obj valueForKeyPath:@"type"]; = [obj valueForKeyPath:@"data"];
self.details = [obj valueForKeyPath:@"errorDetails"];

I can get code, type, msg and so on.

But I cannot get values of data. How can I get its values like thumbsId, thumbsKind and thumbsupCnt?

data is a dictionary inside dictionary so Try this

@property(nonatomic, copy) NSString * thumbsId;
@property(nonatomic, copy) NSString * thumbsKind;

NSDictionary *obj = (NSDictionary *)sender;
NSDictionary *dataDict = (NSDictionary *)  [obj objectForKey:@"data"]

self. thumbsKind = [dataDict valueForKeyPath:@"thumbsKind"];
self.thumbsId = [dataDict valueForKeyPath:@"thumbsId"];