loading...

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

github logo Updated on ・1 min read

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

twitter logo DISCUSS
Classic DEV Post from Sep 27 '19

What was your win this week?

Got to all your meetings on time? Started a new project? Fixed a tricky bug?

Alexey profile image
WPF, ASP.NET Core, REST API, DevExpress, Cache for Redis