JSON Serialization :
var responseDict: [AnyHashable : Any]? = nil
if let anEncoding = responseString?.data(using: String.Encoding(rawValue: String.Encoding.utf8.rawValue)) {
responseDict = try! JSONSerialization.jsonObject(with: anEncoding, options: .mutableContainers) as? [String : Any]
}
I am passing this responseDict in this function :
func apiClientDidFinishWithResponse(response: [AnyHashable : Any]? {
}
Now just realised that responseDict can be an array as well. What should I keep responseDict as ? Any
, [AnyHashable : Any]
, [[AnyHashable : Any]]
?