まあ、私はこれでサーバの応答を持っている:JSON配列から文字列配列を取得する方法は?
{
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;
}
)
}
私は、モデルカーのリストを必要としています。モデル車の配列、リストに設定する。
私はどのように変換できますか?このような? 'ペイロード=レスポンスとしましょう? [String:Any] '? – steibour
サーバのペイロードは標準のJSON形式であり、 'NSURLSessionDataTask'を使ってリクエストしているので、' Data'オブジェクトを取得します。答えは@Vignesh Jが投稿したものです。 Swift-yをもっと使うには、 '[String:Any]'を使うことをお勧めします。 'let payload:[String:Any] = NSJSONSerialization.JSONObjectWithData(データ、オプション:NSJSONReadingOptions.MutableContainers、エラー:なし)! '文字列:Any '' – xiangxin
私はalamofire – steibour