After reading up a bit on collections, I began to wonder if json deserialization was going to be an issue given that collections need to specify a type for the values they contain. And in the case of dictionaries, one would need to specify the type for both the key and the value.
After a bit of experimentation, I found that the following works:
let jsonString = "{\"bool\": true, \"num\": 1,\"string\": \"a string\"}"
let jsonData = jsonString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
let json : AnyObject! = NSJSONSerialization.JSONObjectWithData(jsonData, options: NSJSONReadingOptions.MutableContainers, error: nil)
let valid = NSJSONSerialization.isValidJSONObject(json)
And when I use a playground (or am in the REPL), I get the following when printing out the contents of the json object:
["num": 1, "string": "a string", "bool": 1]
My question: is there may be a better way to handle this?