I am trying to convert some obj-c code to swift specifically part that handles JSON to swift conversion.
I have a JSON string
[{"ID":"1","Field1":"666666","Field2":"111111","Field3":"1","Field4":"30"},
{"ID":"59","Field1":"SCJtDKw","Field2":"dwdSQz8v","Field3":"1","Field4":"1"}]
How can i convert this either into Array or dictionary?
I have tried
var ProductList : NSDictionary = NSJSONSerialization.JSONObjectWithData(data, options:NSJSONReadingOptions.AllowFragments, error:&jsonerror) as NSDictionary
but this crashes on line:
0x1059ea662: nopw %cs:(%rax,%rax)
I have also tried converting it as an array
var ProductList : NSArray = NSJSONSerialization.JSONObjectWithData(data, options:NSJSONReadingOptions.AllowFragments, error:&jsonerror) as NSArray
This line gets further but then crashes on the following line (immediately after the above line)
var ReturnValue : NSMutableArray = ProductList.objectAtIndex(0) as NSMutableArray