I have the following data saved as an NSString :
{ Key = ID; Value = { Content = 268; Type = Text; }; }, { Key = ContractTemplateId; Value = { Content = 65; Type = Text; }; },
I want to convert this data to an NSDictionary containing key value pairs.
I am trying to convert NSString objects to JSON first 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);
I get the value as NULL .
Can anyone guess what the problem is?
json objective-c xcode nsstring nsdictionary
GuybrushThreepwood Sep 11 '13 at 8:30 2013-09-11 08:30
source share