Konvertieren von JSON zu NSArray
Habe ich ein JSON-array wird ausgegeben auf einer Seite. Ich möchte zu konvertieren, das JSON-array in einem NSArray.
Dies ist die JSON-Ausgabe auf der web-Seite:
[{"city":"Current Location"},{"city":"Anaheim, CA"},{"city":"Los Angeles, CA"},{"city":"San
Diego, CA"},{"city":"San Francisco, CA"},{"city":"Indianapolis, IN"}]
Dies ist mein NSURL anrufen und NSJSONSerialization:
NSString *cityArrayURL = [NSString stringWithFormat:@"http://site/page.php";
NSData *cityData = [NSData dataWithContentsOfURL:[NSURL URLWithString:cityArrayURL]];
NSError *error;
NSDictionary *cityJSON = [NSJSONSerialization JSONObjectWithData:cityData
options:kNilOptions error:&error];
Ich würde gerne die NSDictionary genannt cityJSON in einem NSArray. Kann jemand lassen Sie mich wissen, was der nächste Schritt sein könnte? Danke!
InformationsquelleAutor Brandon | 2014-10-11
Du musst angemeldet sein, um einen Kommentar abzugeben.
Wie über dieses?
InformationsquelleAutor Fahim Parkar
InformationsquelleAutor raurora
JSONObjectWithData
zurück NSArray, wenn root-Objekt array-Typ.Drucken
InformationsquelleAutor Krzysztof
Mein Json Sieht wie
und mein code ist
InformationsquelleAutor abdul sathar