By default, when calling a Web API endpoint in ASP.NET, the JSON response properties are formatted in camel case.
However, in C#, public class members are typically named using Pascal Case.
If you want to keep Pascal Case in the JSON response, you can disable the default camel case transformation.
To disable camel case formatting in JSON responses, add the following code to the Program.cs
file:
builder.Services
.AddControllersWithViews()
.AddJsonOptions(opt => opt.JsonSerializerOptions.PropertyNamingPolicy = null);
ยฉ 2025 juniyunapapa@gmail.com.