How can I serialize JSON in swift? I am trying to serialize using this method, however it is causing EXC_BAD_INSTRUCTION. For downloading JSON data, I am using NSURLConnection.
var sJson : NSDictionary = NSJSONSerialization.JSONObjectWithData(nsMutData, options: NSJSONReadingOptions.MutableContainers, error: nil) as NSDictionary
How can I solve it?
Regards
JSONObjectWithDatawill turn yourNSMutableDataobject into anNSDictionaryorNSArray, so that's a deserialisation process. Your code fragment looks valid as well - it worked for me.var error: NSError?' then pass in&error` as the last parameter toJSONObjectWithData