asp.net-corecloudflare

Type name 'serializeObject' does not exist in the type 'JsonConvert'


I am trying to convert some data to Json to send to the CloudFlare API. I am attempting to use Newtonsoft.Json.JsonConvert.SeriablizeObject() to accomplish this but I am getting the Intellisense error that the type name 'serializeObject' does not exist in the type 'JsonConvert'. I have the NuGet package Newtonsoft.Json installed but it does not recognize the SerializeObject() method. I am not sure what I am missing.

enter image description here


Solution

  • Its because you're calling the method wrong, remove the new operator from the line

    var json = new JsonConvert.SerializeObject(updateDnsRecord);
    

    to

    var json = JsonConvert.SerializeObject(updateDnsRecord);