Alamofireを使用してJSONデータをSwiftのDictionaryに変換したいと思います。 私はif let dict = response.result.value as? Dictionary<String, AnyObject> { ... }
を試していましたが、残念ながらそれは動作しません。助言がありますか?前もって感謝します。これは、辞書の配列を作成する必要がありますので、あなたの応答が配列であるので、私のresponse.result.value
Alamofireを使用してSwiftでJSONを辞書に変換する
Optional(<__NSArrayI 0x6000002893d0>(
{
category = category1;
description = description1;
name = sth1;
id = 1;
price = "213";
type = type1;
},
{
category = category2;
description = description2;
name = sth2;
id = 2;
price = "2133";
type = type4;
},
{
category = category3;
description = description3;
name = sth3;
id = 3;
price = "21334";
type = type5;
}
)
)
なぜ[ObjectMapper](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwipqdDNzqPRAhWPN1AKHeXAA7wQFggbMAA&url=https%3A%2Fを使用しません%2Fgithub.com%2FHearst-DD%2FObjectMapper&usg = AFQjCNFyUn25wAdc4YI3J79e10bh5EsWTQ)? –