NSString *jsonArray = @"";
NSMutableArray *array = [[NSMutableArray alloc] init];
for (int i=0; i<10; i++) {
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
dict[@"id"] = [NSNumber numberWithInt:i];
[array addObject:dict];
}
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:nil];
jsonArray = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
jsonArray即为array转成的字符串。