Skip to content

Instantly share code, notes, and snippets.

@castillejoale
Created January 20, 2017 03:21
Show Gist options
  • Save castillejoale/bc53a5f4189d65d0bb8dca29281e6fa6 to your computer and use it in GitHub Desktop.
Save castillejoale/bc53a5f4189d65d0bb8dca29281e6fa6 to your computer and use it in GitHub Desktop.
import UIKit
import AVFoundation
//JSON String -> Dictionary
let jsonText = "{\"anotherKey\":\"anotherValue\",\"aKey\":\"aValue\"}"
var dictonary:NSDictionary?
if let data = jsonText.dataUsingEncoding(NSUTF8StringEncoding) {
do {
dictonary = try NSJSONSerialization.JSONObjectWithData(data, options: []) as? [String:AnyObject]
} catch let error as NSError {
print(error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment