Software Information
Need to change the JSON Serializer setting
Configuring JSON Serializer setting
The first step is to configure the
JSON Serializer settings in the
Program.cs file.
1. Open the Program.cs class from the Solution Explorer window.
2. Inside Program.cs class, the AddJsonOptions method of the Services property is called where the PropertyNamingPolicy is set to NULL.
This will remove the default
Camel Case naming policy and
JSON property names will remain intact as defined in the classes.
var builder =WebApplication.CreateBuilder(args);
// Enabling MVC
builder.Services.AddControllersWithViews()
.AddJsonOptions(options =>options.JsonSerializerOptions.PropertyNamingPolicy= null);