[let appUrl = URL(string: "some link")!
let data = try Data(contentsOf: appUrl)
let json2 = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as! [String : AnyObject]
let post = json2["posts"] as? [[String:AnyObject]]
// here I want to connect to image but its still tell me the problem
//type '[[String : AnyObject]]' has no subscript members
let image = post["image"] as [[String:AnyObject]]
print(image)
タイプ '[[文字列:ANYOBJECT]]' は添字メンバー
JSONの実際の構造は何ですか?あなたは 'post'を辞書の配列として宣言しましたが、' post'を次の行の辞書として扱います。 – rmaddy
どうすればいいですか? –
JSONのサンプル構造を投稿できますか? –