DEV Community

Alexey
Alexey

Posted on • Updated on

Answer: How to turn off or handle camelCasing in JSON response ASP.NET Core?

In Asp.Net Core 3.0 some things have changed. For camelCase do nothing that is out of the box. For PascalCase or another set style use.

services.AddMvc(setupAction=> {
            setupAction.EnableEndpointRouting = false;
        }).AddJsonOptions(jsonOptions =>
        {
            jsonOptions.JsonSerializerOptions.PropertyNamingPolicy = null;
        })
        .SetCompatibilityVersion(CompatibilityVersion.Version_3_0);

In Startup.cs ConfigureServices section

Top comments (0)