Parse nested JSON Swift 3
<p>I'm trying to parse complex JSON file in Swift 3. I'm having trouble with getting values. I found some sample code and tried to tweak it a bit but it doesn't work I currently get an error "Type "NSArray?" has no subscript members"... I'm not even sure this is the right way to do it. Attaching JSON screenshot any advice on how to properly parse it really appreciated. </p>

<p>Here's my current code:</p>

<pre><code>let jsonResult = try JSONSerialization.jsonObject(with: urlContent, options: JSONSerialization.ReadingOptions.mutableContainers) as AnyObject

let mainlistJson = jsonResult["mainlist"]as? NSArray

if let items = mainlistJson["items"] as? NSArray 
{
for item in items {
 if let description = item["description"]as? String {
 print(description)
}  } }
</code></pre>

<p><a href="https://i.stack.imgur.com/GyKuW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GyKuW.png" alt="json sample"></a></p>