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
}

1 Answer 1

0

You could add the converter to the JsonOptions

builder.Services.Configure<JsonOptions>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.