如何解析包含u'字符的JSON?

时间:2016-05-26 03:19:15

标签: ios objective-c json

我想获得blank fill数组,但我得到的arrayBnil。我该怎么做?

JSON:

{
    result =     {
        blankfill = "[[1, [u'', u'', u'', u''], False, 0]]";
        choice = "[[1599, [1], False, 2], [1598, [1], False, 5], [1596, [1], True, 4], [1594, [1], True, 2], [1593, [1], False, 2], [1592, [1], False, 2]]";
        spendTime = 20;
    };
    retcode = 0;
    subjectid = 1;
    submittime = "2016-05-07T18:43:35.094";
}

代码:

NSString *jsonStringB = [responseObject[@"result"] objectForKey:@"blankfill"];
NSString *jsonSB = [jsonStringB stringByReplacingOccurrencesOfString:@"False" withString:@"false"];
NSString *jsonSBA = [jsonSB stringByReplacingOccurrencesOfString:@"True" withString:@"true"];

NSData *dataB = [jsonSBA dataUsingEncoding:NSUTF8StringEncoding];
NSArray *arrayB = [NSJSONSerialization JSONObjectWithData:dataB options:NSJSONReadingMutableContainers error:nil];

for (NSArray *arr in arrayB) {
    TaskConditonModel *model = [[TaskConditonModel alloc] init];
    [model initModelWithArray:arr];
    [self.blankfillArray addObject:model];
}

0 个答案:

没有答案