typealias JSON = AnyObject
typealias JSONDictionary = Dictionary
typealias JSONArray = Array
func _JSONString(object: JSON)->String? {
return object as? String
}
func _JSONInt(object: JSON)->Int? {
return object as? Int
}
func _JSONObject(object: JSON)->JSONDictionary {
return object as? JSONDictionary
}
func decodeJSON(data: NSData)->Result {
let jsonOptional: JSON! = try?NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions(rawValue:0))
return resultFromOptional(jsonOptional, error: NSError())
}
func decodeObject(json: JSON)->Result {
return resultFromOptional(U.decode(json), error:NSError())
}