Nun habe ich eine Antwort des Servers mit diesem:Wie bekomme ich ein String-Array von JSON-Arrays?
{
cars = (
{
"color" = red;
"model" = ferrari;
"othersAtributes" = others atributes;
},{
"color" = blue;
"model" = honda;
"othersAtributes" = others atributes;
},{
"color" = green;
"model" = ford;
"othersAtributes" = others atributes;
},{
"color" = yellow;
"model" = porshe;
"othersAtributes" = others atributes;
}
)
}
Ich brauche eine Liste von Modellautos. eine Reihe von Modellen Autos, um eine Liste zu setzen.
Wie kann ich konvertieren? so was? 'Let Payload = Antwort als? [String: Irgendein] '? – steibour
Ich nehme an, die Server-Nutzlast ist in Standard-JSON-Form und Sie fordern es mit 'NSURLSessionDataTask' an, so dass Sie ein' Data'-Objekt erhalten. Dann wird die Antwort sein, was @Vignesh J gepostet hat. Obwohl ich '[String: Any]' empfehlen würde, um schneller zu sein. 'let Nutzlast: [String: Beliebig] = NSJSONSerialization.JSONObjectWithData (Daten, Optionen: NSJSONReadingOptions.MutableContainers, Fehler: nil) as! [String: Any] ' – xiangxin
Ich mache es mit Alamofire – steibour