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 5
extension String { func convertToDictionary() -> [String: Any]? { if let data = data(using: .utf8) { return try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] } return nil } }