Hi i'm making app that take json from web page but its not converting the jsonData to Dict using touchJson (Framework, Library, Class)
The Json
{SFP:[{"Group":"Oil"},{"Group":"Sugar"}]}
TheCode
NSStringEncoding *Encoding;
NSError *Error;
NSURL *PriceURL = [NSURL URLWithString:@"http://xxx.co/SFP/?Q=P1"];
NSString *JsonString = [[NSString alloc] initWithContentsOfURL:PriceURL usedEncoding:Encoding error:&Error];
NSData *JsonData = [JsonString dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSDictionary *Dict = [[[CJSONDeserializer deserializer] deserializeAsDictionary:JsonData error:&Error] retain];
NSArray *Rows = [Dict objectForKey:@"SFP"];
NSLog(@"%@", JsonString);
NSLog(@"%@", JsonData);
NSLog(@"%@", Dict);
The Consol
2012-08-05 14:49:02.794 SFP[23791:f803] {SFP:[{"Group":"Oil"},{"Group":"Sugar"}]}
2012-08-05 14:49:02.795 SFP[23791:f803] <0000007b 00000053 00000046 00000050 0000003a 0000005b 0000007b 00000022 00000047 00000072 0000006f 00000075 00000070 00000022 0000003a 00000022 0000004f 00000069 0000006c 00000022 0000007d 0000002c 0000007b 00000022 00000047 00000072 0000006f 00000075 00000070 00000022 0000003a 00000022 00000053 00000075 00000067 00000061 00000072 00000022 0000007d 0000005d 0000007d>
2012-08-05 14:49:02.795 SFP[23791:f803] (null)
is not valid JSON, all keys should be quoted. The correct, parseable JSON would be