我正在尝试将一些数据转换为Json以发送到CloudFlare API。我正在尝试使用Newtonsoft.Json.JsonConvert.SeriablizeObject()完成此操作,但出现了智能感知错误,即类型名称“ serializeObject”在类型“ JsonConvert”中不存在。我安装了NuGet包Newtonsoft.Json,但无法识别SerializeObject()方法。我不确定我缺少什么。
答案 0 :(得分:2)
由于您错误地调用了该方法,因此请从该行中删除新的运算符
var json = new JsonConvert.SerializeObject(updateDnsRecord);
到
var json = JsonConvert.SerializeObject(updateDnsRecord);