I have a set of Azure Functions v3 running on .NET Core 3.1.
I need to specify custom System.Text.Json converters so I provided a custom JsonSerializerOptions instance when I build a JsonResult in my function:
return new JsonResult(<ContractClass>, NSJsonSerializerOptions.Default)
{
StatusCode = StatusCodes.Status200OK
};
Question
I get the following error and I am not sure where Newtonsoft is coming from since ASP.NET Core is supposed to use System.Text.Json:
Microsoft.AspNetCore.Mvc.NewtonsoftJson: Property 'JsonResult.SerializerSettings' must be an instance of type 'Newtonsoft.Json.JsonSerializerSettings'.
Update
I found out that the JsonResult instance is looking for an implementation of IActionResultExecutor<JsonResult> and gets an NewtonsoftJsonresultExecutor instead of an SystemTextJsonResultExecutor. Here is the code for the JsonResult's ExecuteResultAsync method:
I would have though that the Azure Function would rely on ASP.Net Core which relies on System.Text.Json.
