这是我的JSON回复:
{"#error":false,
"#data":
{"personal_info":
{"basic_information":
{"EmailAddress":"k_bhuvaneswari@hcl.com",
"PasionProfessional":null,
"PasionPersonal":null,
"WorkLocation":"Chennai-AMB-6, Amb. Ind. Est., MTH Rd, 8",
"Country":null,
"City":null,
"Latitude":null,
"Longitude":null,
"Title":"Software Engineer",
"HomeTown":null,
"RelationshipStatus":null,
"BriefBio":null,
"FavouriteQuotation":null},
"education":
{"HighSchool":null,
"HighSchoolYear":null,
"HigherSecondary":null,
"HSSYear":null,
"DiplomaTechnical":null,
"DiplomaInsitute":null,
"YearofDiploma: ":null,
"Degree":null,
"YearofPassing":null,
"College/University":null,
"PostGraduation":null,
"YearofPostGraduation":null,
"PGCollege/University":null},
"interest":
{"Keywords":null},
"contact_information":
{"MobilePhone":"9791729428",
"BusinessCode":null,
"BusinessPhone":null,
"OtherCode":null,
"OtherPhone":null,
"Website":null}},
"work_profile_info":
{"profile_title":"",
"profile_bio":""},
"boolean":"1"}}
现在我想以编程方式显示标签:
EmailAddress k_bhuvaneswari@hcl.com
PasionProfessional Nil
我该怎么做?
答案 0 :(得分:0)
很简单。您需要一个允许您解析收到的数据的JSON库。我个人喜欢JSONKit
。
NSURL *url = [NSURL URLWithString:@"http://url.com"];
NSData *data = [NSData dataWithContentsOfURL:url];
NSDictionary *dict = [data objectFromJSONString]; //JSONKit
然后你可以放下结构并抓住你想要的东西:
NSString *email = [dict valueForKeyPath:@"#data.personal_info.basic_information. EmailAddress"];