-1
let jsonResult = NSJSONSerialization.JSONObjectWithData(data!, options: NSJSONReadingOptions.MutableContainers, error: nil) as! NSArray

I am getting error:

Could not cast value of type '__NSDictionaryM' (0x10322f8a8) to 'NSArray' (0x10322f470).## Heading ##

zaph
  • 111,848
  • 21
  • 189
  • 228
PDM
  • 1
  • 1
  • 2
    Possible duplicate of [How to parse a JSON file in swift?](http://stackoverflow.com/questions/24013410/how-to-parse-a-json-file-in-swift) – 2787184 Dec 01 '15 at 02:45

1 Answers1

1

The error says it all, the function is returning an NSDictionary data type and you are trying to type force it to an NSArray, there is no automated conversion between these two types. Check this link to see how to convert the keys into an array, then you can use the keys in the array to access the dictionary values.

Community
  • 1
  • 1
PeteB
  • 372
  • 1
  • 10