Reputation: 149
let df = dict["forms"] as? Array<Dictionary<String,Any>>
let dfs = dict["forms"] as? Array<Dictionary<Dictionary<String,Any>>>
The second line is what produces the error. I am uncertain of the correct syntax here. I am trying to grab a dictionary inside the dictionary. I don't see why this syntax doesn't work
Upvotes: 0
Views: 2185
Reputation: 726599
To get the dictionary inside a dictionary you need to specify the key type of the outer dictionary. Assuming it's String
, use
Array<Dictionary<String,Dictionary<String,Any>>>
// ^^^^^^
or
[[String : [String : Any]]]
Upvotes: 2