#import <Foundation/Foundation.h>
NSString *jsonString = @"{\"user\":[{\"role\": [1, 3, 4],\"address\":{\"city\": \"biejing\"}}]}";
int main(int argc, const char * argv[])
{
@
autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
NSData *data = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *err;
NSMutableDictionary * dict = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&err];
dict[@"user"][0][@"address"][@"city"] = @"Shanghai";
NSLog(@"%@",dict);
}
return 0;
}