We upgraded a .NET core 2.2 project to .NET 6 and were having some issues with Newtonsoft.Json so decided to switch to using System.Text.Json;
Was able to find most of the conversions online:
switching to System.Text.Json nodes Equivalent of JObject in System.Text.Json
and from:
var value = JsonSerializer.Serialize(allImages);
to
var value = JsonConvert.SerializeObject(allImages);
My question is I can't find the conversion for the program.cs file
JsonConvert.DefaultSettings = () =>
{
return new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
};
How can I convert the above code from Newtonsoft.Json to System.Text.Json please?