我将以下数据保存为NSString
:
{
Key = ID;
Value = {
Content = 268;
Type = Text;
};
},
{
Key = ContractTemplateId;
Value = {
Content = 65;
Type = Text;
};
},
我想将此数据转换为包含键值对的NSDictionary
.
I am trying first to convert the NSString
to a JSON objects as follows :
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
id json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
However when I try :
NSString * test = [json objectForKey:@"ID"];
NSLog(@"TEST IS %@", test);
我得到的值是NULL
.
有人能提出什么问题吗?