{"action":"created","issue":{"url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/175","labels_url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/175/labels{/name}","comments_url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/175/comments","events_url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/175/events","html_url":"https://github.com/SwiftyJSON/SwiftyJSON/issues/175","id":62187070,"number":175,"title":"Swift 1.2 - Is SwiftyJSON still usefull ?","user":{"login":"thedamfr","id":2880446,"avatar_url":"https://avatars.githubusercontent.com/u/2880446?v=3","gravatar_id":"","url":"https://api.github.com/users/thedamfr","html_url":"https://github.com/thedamfr","followers_url":"https://api.github.com/users/thedamfr/followers","following_url":"https://api.github.com/users/thedamfr/following{/other_user}","gists_url":"https://api.github.com/users/thedamfr/gists{/gist_id}","starred_url":"https://api.github.com/users/thedamfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedamfr/subscriptions","organizations_url":"https://api.github.com/users/thedamfr/orgs","repos_url":"https://api.github.com/users/thedamfr/repos","events_url":"https://api.github.com/users/thedamfr/events{/privacy}","received_events_url":"https://api.github.com/users/thedamfr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-16T19:35:37Z","updated_at":"2015-03-20T11:23:15Z","closed_at":null,"body":"Hi !\r\n\r\nI'm an happy user of SwiftyJSON !\r\nI was reading this article : http://nshipster.com/swift-1.2/\r\nWhen I saw this\r\n``` swift\r\nvar users: [User] = []\r\n\r\n// load and parse the JSON into an array\r\nif let\r\n    path     = NSBundle.mainBundle().pathForResource(\"users\", ofType: \"json\"),\r\n    url      = NSURL(fileURLWithPath: path),\r\n    data     = NSData(contentsOfURL: url),\r\n    userList = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil) as? [[String: AnyObject]] \r\n{\r\n    // extract individual users\r\n    for userDict in userList {\r\n        if let\r\n            id      = userDict[\"id\"] as? Int,\r\n            name    = userDict[\"name\"] as? String,\r\n            email   = userDict[\"email\"] as? String,\r\n            address = userDict[\"address\"] as? [String: AnyObject]\r\n        {\r\n            users.append(User(id: id, name: name, ...))\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nAmazing, no ? What the impact on SwiftyJSON ?\r\n\r\nBisou"},"comment":{"url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/comments/83989456","html_url":"https://github.com/SwiftyJSON/SwiftyJSON/issues/175#issuecomment-83989456","issue_url":"https://api.github.com/repos/SwiftyJSON/SwiftyJSON/issues/175","id":83989456,"user":{"login":"totiz","id":459912,"avatar_url":"https://avatars.githubusercontent.com/u/459912?v=3","gravatar_id":"","url":"https://api.github.com/users/totiz","html_url":"https://github.com/totiz","followers_url":"https://api.github.com/users/totiz/followers","following_url":"https://api.github.com/users/totiz/following{/other_user}","gists_url":"https://api.github.com/users/totiz/gists{/gist_id}","starred_url":"https://api.github.com/users/totiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/totiz/subscriptions","organizations_url":"https://api.github.com/users/totiz/orgs","repos_url":"https://api.github.com/users/totiz/repos","events_url":"https://api.github.com/users/totiz/events{/privacy}","received_events_url":"https://api.github.com/users/totiz/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T11:23:15Z","updated_at":"2015-03-20T11:23:15Z","body":"I've used SwiftyJSON for a while, and I thinks swift 1.2 is a big improvement.\r\nTo answer your question, yes it impact SwiftyJSON in term of more easier to use.\r\nIn term of \"Do I want SwiftyJSON in swift 1.2?\", the answer is still \"YES\" as example below.\r\n\r\nExample 1,\r\n```\r\n// Without SwiftyJSON\r\n    for userDict in userList {\r\n        if let\r\n            id      = userDict[\"id\"] as? Int,\r\n            name    = userDict[\"name\"] as? String,\r\n            email   = userDict[\"email\"] as? String,\r\n            address = userDict[\"address\"] as? [String: AnyObject]\r\n        {\r\n            users.append(User(id: id, name: name, ...))\r\n        }\r\n    }\r\n\r\n// With SwiftyJSON\r\n    for userJson in userListJson.arrayValue {\r\n        if let\r\n            id      = userJson[\"id\"].int,\r\n            name    = userJson[\"name\"].string,\r\n            email   = userJson[\"email\"].string,\r\n            address = userJson[\"address\"].dictionaryObject\r\n        {\r\n            users.append(User(id: id, name: name, ...))\r\n        }\r\n    }\r\n```\r\nThis example is quite similar for bot with and without SwiftyJSON.\r\n\r\n\r\nExample 2: Use default value if some keys have no value\r\n```\r\n// Without SwiftyJSON\r\n    for userDict in userList {\r\n        let id = userDict[\"id\"] as? Int ?? 0\r\n        let name = userDict[\"name\"] as? String ?? \"\"\r\n        let email = userDict[\"email\"] as? String ?? \"\"\r\n        let address = userDict[\"address\"] as? [String: AnyObject] ?? [:]\r\n        users.append(User(id: id, name: name, ...))\r\n    }\r\n\r\n// With SwiftyJSON\r\n    for userJson in userListJson.arrayValue {\r\n        let id = userJson[\"id\"].intValue\r\n        let name = userJson[\"name\"].stringValue\r\n        let email = userJson[\"email\"].stringValue\r\n        let address = userJson[\"address\"].dictionaryObject ?? [:]\r\n        users.append(User(id: id, name: name, ...))\r\n    }\r\n```\r\n\r\nExample 3: Key chain (assume address is dictionary)\r\n```\r\n// Without SwiftyJSON\r\n    let street = (userList[0][\"address\"] as? [String: AnyObject])?[\"street\"] as? String\r\n\r\n// With SwiftyJSON\r\n    let street = userListJson[0][\"address\"][\"street\"].string\r\n```\r\n\r\nJust some example, you will see a lot benefits  when you dealing with more complex json data (bot get and set). "}}