0

I tried using the following line

builder.Services.Configure<JsonSerializerOptions>(options => options.Converters.Add(new JsonStringEnumConverter()));

to configure that the enums are converted to string when returning

return Results.Ok(new SummarizationResult(SummarizationStatus.InProcess));

being the enum

public enum SummarizationStatus
{
    Ok,
    Failed,
    InProcess
}

But that keeps returning the enum as a number 2

{
    "status": 2,
    "message": null,
    "summary": null
}
user33276346
  • 1,501
  • 1
  • 19
  • 38

1 Answers1

0

You could add the converter to the JsonOptions

builder.Services.Configure<JsonOptions>

Selmir Aljic
  • 268
  • 2
  • 9