So i'm using touch JSON which worked out pretty well for me. I was able to take an array, put it in a dictionary, serialize it via touchJSON and send it out via http.
now on the return end, i received the data, and put it into a dictionary (i'm using trends.json from twitter as an example JSON).
now if i try to get the value for trends from the dictionary object, i get this http://cl.ly/fe270fe7f05a0ea8d478
If I try to get the value for name or URL, I get nothing which is frustrating. That is the data I will need. You can tell it is in a dictionary format because it is formatted and it is reading properly sort of for trends. I'm pretty sure I'm missing something, so please let me know which direction to follow.
Here is the code:
// this is all touch JSON magic. responseString has the full contents of trends.json
NSString *response = [request responseString];
NSLog(@"response value is:%@",response);
NSString *jsonString = response;
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSError *error = nil;
NSDictionary *dictionary = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
//end of touchJSON. It is in a dictionary now.
NSLog(@"dictionary:%@, error %@", dictionary, error); //http://cl.ly/adb6c6a974c3e70fb51c
NSString *twitterTrends = (NSString *) [dictionary objectForKey:@"trends"];
NSLog(@"ANSWER:%@",twitterTrends); //http://cl.ly/fe270fe7f05a0ea8d478