Hi I am trying to do a simple JSON string to Object conversion. Here is the code:
let u = "somehost.com/api/1/ipa/2"
let url = NSURL(string: u )!
let data = NSData(contentsOfURL: url)!
let parsed: AnyObject? = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.AllowFragments)
if let json = parsed as? [String: AnyObject]{
// parse json.
}
but it will not unwrap correctly. Seems to me that this should be much simpler. Could someone please help? Also using Xcode 7.3 and swift 2.2.
I want to avoid using a third party library.
