There is no native code to parse a JSON response with objective-c, but there are third party libraries readily available. TouchJSON is a popular example of this.
How to handle string response from facebook api?
Pregunta
Hi, I got the string from facebook api as:
family = (
{relationship = brother;uid = 100767;},
relationship = cousin;uid = 10900;},
{name = myaunt;relationship = aunt;},
{ name = krish; relationship = uncle;}
);
How to get an array of relationship and uid from this?
I got the result as:
relation = (
brother,
cousin,
aunt,
uncle
)
How to handle this string?
Solución
Otros consejos
if you are using ios 5
NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData: self.responseData options: NSJSONReadingMutableContainers error: &err];
else use SBJSON from github parser to parse the repsonse of facebook api
NSArray *response = [[responseDictionary objectForKey:@"family"] valueForKey:@"relationship"];
and store them in array same can be achieved for UID also
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow