I want to make one function in my swift project that converts String to Dictionary json format but I got one error:
Cannot convert expression\'s type
Swift 4
extension String { func convertToDictionary() -> [String: Any]? { if let data = self.data(using: .utf8) { do { return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] } catch { print(error.localizedDescription) } } return nil } }