iOS-JSON数据与NSDictionary和NSArray之
NSError *error = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:theData options:NSJSONWritingPrettyPrinted error:&error];
NSString *jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
- 2、将JSON串转化为NSDictionary或NSArray
- 将NSString转化为NSData
[jsonString dataUsingEncoding:NSASCIIStringEncoding];
id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error];
本文标题:iOS-JSON数据与NSDictionary和NSArray之
本文链接:https://www.haomeiwen.com/subject/irlrattx.html
网友评论