title: Change JSON serialization from camelCase to PascalCase [Duplicate-No solution?]
body: <p>I know this is duplicate of some past questions.But there were no real solution.</p>
  
  <p><a href="https://stackoverflow.com/questions/50986792/json-serializer-not-working-after-upgrade-to-3-6-2">One of the related links</a></p>
  
  <p><a href="https://stackoverflow.com/questions/55416179/change-json-serialization-from-camelcase-to-pascalcase">Another one</a></p>
  
  <p>I am working with .Net Core 3 Multipage Template.
  I've tried everything like given below. But no use. </p>
  
  <p>This is my interface from application project:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Abp.Application.Services;
  using Abp.Application.Services.Dto;
  using TSE.Kalibrasyon.Roles.Dto;
  using TSE.Kalibrasyon.Users.Dto;
  
  namespace TSE.Kalibrasyon.Labs
  {
      public interface ILabAppService : IApplicationService
      {
          string Test();
          Task&lt;List&lt;Entities.Labs.Labs&gt;&gt; GetAllAsync();
          System.Threading.Tasks.Task Update(Entities.Labs.Labs input);
          System.Threading.Tasks.Task Create(Entities.Labs.Labs input);
      }
  }
  </code></pre>
  
  <p>and the implementation is:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using System.Text.RegularExpressions;
  using System.Threading.Tasks;
  using Abp.Application.Services;
  using Abp.Application.Services.Dto;
  using Abp.Authorization;
  using Abp.Domain.Entities;
  using Abp.Domain.Repositories;
  using Abp.Extensions;
  using Abp.IdentityFramework;
  using Abp.Linq.Extensions;
  using Abp.Localization;
  using Abp.Runtime.Session;
  using Abp.UI;
  using TSE.Kalibrasyon.Authorization;
  using TSE.Kalibrasyon.Authorization.Accounts;
  using TSE.Kalibrasyon.Authorization.Roles;
  using TSE.Kalibrasyon.Authorization.Users;
  using TSE.Kalibrasyon.Roles.Dto;
  using TSE.Kalibrasyon.Users.Dto;
  using Microsoft.AspNetCore.Identity;
  using Microsoft.EntityFrameworkCore;
  using TSE.Kalibrasyon.Entities.Labs.Dto;
  using TSE.Kalibrasyon.Entities.Labs;
  using TSE.Kalibrasyon.Labs.Dto;
  using Abp.Web.Models;
  using Newtonsoft.Json;
  using Microsoft.AspNetCore.Mvc;
  
  namespace TSE.Kalibrasyon.Labs
  {
      //[AbpAuthorize(PermissionNames.Pages_Users)]
      public class LabAppService : KalibrasyonAppServiceBase, ILabAppService
      {
          private readonly IRepository&lt;Entities.Labs.Labs&gt; _labRepository;
  
  
          public LabAppService(IRepository&lt;Entities.Labs.Labs&gt; labRepository)
          {
              _labRepository = labRepository;
          }
          [Microsoft.AspNetCore.Mvc.HttpGet]
          public string Test()
          {
              return "merhaba";
          }
          [DontWrapResult]
          public  async Task&lt;List&lt;Entities.Labs.Labs&gt;&gt; GetAllAsync()
          {
              //var chk = await _labRepository.GetAllListAsync();
              return await _labRepository.GetAllListAsync();
          }
  
          [DontWrapResult]
          //public  List&lt;Entities.Labs.Labs&gt; GetAll2()
          public  object GetAll2()
          {
              List&lt;Entities.Labs.Labs&gt; chk = _labRepository.GetAllListAsync().Result;
              //return _labRepository.GetAllListAsync().Result;
              var bak= new { Items = chk, Count = chk.Count() };
              return new { Items = chk, Count = chk.Count() };
              //return Json(new { Items = chk, Count = chk.Count() }, new JsonSerializerSettings { ContractResolver = new PascalCasePropertyNamesContractResolver() });
          }
  
          [DontWrapResult]
          public string GetAll3()
          {
              List&lt;Entities.Labs.Labs&gt; chk = _labRepository.GetAllListAsync().Result;
              var obj= new { Items = chk, Count = chk.Count() };
              //return Json(new { Items = chk, Count = chk.Count() }, new JsonSerializerSettings { ContractResolver = new PascalCasePropertyNamesContractResolver() });
              var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };
              //var text = JsonConvert.SerializeObject(configuration, settings);
              var text = JsonConvert.SerializeObject(obj);
              return text;
              //return Json(new { Items = chk, Count = chk.Count() });
  
          }
  
          public async Task Update(Entities.Labs.Labs input)
          {
              await _labRepository.UpdateAsync(input);
          }
          public async Task Create(Entities.Labs.Labs input)
          {
              await _labRepository.InsertAsync(input);
          }
      }
  
  
      //public class Data
      //{
      //    public bool requiresCounts { get; set; }
      //    public int skip { get; set; }
      //    public int take { get; set; }
      //}
  }
  </code></pre>
  
  <p>and the response body is:</p>
  
  <pre><code>[
    {
      "labName": "BASINÇ KALİBRASYON LABORATUVARI",
      "labKod": "BAS",
      "bolgeKodu": 5,
      "id": 1
    }
  ]
  </code></pre>
  
  <p>My model for this entity is :</p>
  
  <pre><code>using Abp.Domain.Entities;
  using Abp.Domain.Repositories;
  using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations.Schema;
  using System.Text;
  
  namespace TSE.Kalibrasyon.Entities.Labs
  {
      [Table("Labs")]
      public partial class Labs : Entity
      {
          private readonly IRepository&lt;Labs&gt; _lablarRepository;
          //private readonly TownAppService _townAppService;
          //private readonly IRepository&lt;Town&gt; _townRepository;
          public Labs()
          {
              //this.Towns = new List&lt;Town&gt;();
              //this.Districts = new List&lt;District&gt;();
              //this.Neighborhoods = new List&lt;Neighborhood&gt;();
              OnCreated();
          }
  
          //[System.ComponentModel.DataAnnotations.Key]
          //[System.ComponentModel.DataAnnotations.Required()]
          //public virtual int Id
          //{
          //    get;
          //    set;
          //}
  
          [System.ComponentModel.DataAnnotations.Required()]
          public virtual string LabName
          {
              get;
              set;
          }
  
          [System.ComponentModel.DataAnnotations.StringLength(3)]
          [System.ComponentModel.DataAnnotations.Required()]
          public virtual string LabKod
          {
              get;
              set;
          }
  
          [System.ComponentModel.DataAnnotations.Required()]
          public virtual int BolgeKodu
          {
              get;
              set;
          }
  
  
  
  
  
          #region Extensibility Method Definitions
  
          partial void OnCreated();
  
          #endregion
      }
  }
  </code></pre>
  
  <p>And there is an another big problem also, I am using Syncfusion .Net Core Grid as a third party tool. It requires a method for database operations as given below.</p>
  
  <pre><code>[IgnoreAntiforgeryToken]
          public IActionResult UrlDatasource([FromBody]DataManagerRequest dm)
          {
              Api api=new Api();
  
              //IEnumerable DataSource = Orders.GetAllRecords();
              IEnumerable DataSource = api.LabsGetAll();
              DataOperations operation = new DataOperations();
  
  
              if (dm.Search != null &amp;&amp; dm.Search.Count &gt; 0)
              {
                  DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search
              }
              if (dm.Sorted != null &amp;&amp; dm.Sorted.Count &gt; 0) //Sorting
              {
                  DataSource = operation.PerformSorting(DataSource, dm.Sorted);
              }
              if (dm.Where != null &amp;&amp; dm.Where.Count &gt; 0) //Filtering
              {
                  DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator);
  
  
  
              }
              int count = DataSource.Cast&lt;Entities.Labs.Labs&gt;().Count();
              if (dm.Skip != 0)
              {
                  DataSource = operation.PerformSkip(DataSource, dm.Skip);         //Paging
              }
              if (dm.Take != 0)
              {
                  DataSource = operation.PerformTake(DataSource, dm.Take);
              }
              return dm.RequiresCounts ? Json(new { result = DataSource, count = count }) : Json(DataSource);
          }
  </code></pre>
  
  <p>When I don't use the  [IgnoreAntiforgeryToken] for the method. It doesn't hit the method with the  HTTP ERROR 415.</p>
  
  <p>Syncfusion says that, it is just because of camel casing and offers adding the </p>
  
  <pre><code>services.PostConfigure&lt;MvcJsonOptions&gt;(options =&gt;
  {
      options.SerializerSettings.ContractResolver = new DefaultContractResolver();
  }); 
  </code></pre>
  
  <p>into ConfigureServices method of StartUp file. But I think it works only with the .net core 2.x. It was not a solution for me with ABP working on .net core 3.0</p>
  
  <p>My StartUp.cs in Host App is:</p>
  
  <pre><code>using System;
  using System.Linq;
  using System.Reflection;
  using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Logging;
  using Castle.Facilities.Logging;
  using Abp.AspNetCore;
  using Abp.AspNetCore.Mvc.Antiforgery;
  using Abp.Castle.Logging.Log4Net;
  using Abp.Extensions;
  using TSE.Kalibrasyon.Configuration;
  using TSE.Kalibrasyon.Identity;
  using Abp.AspNetCore.SignalR.Hubs;
  using Abp.Dependency;
  using Abp.Json;
  using Microsoft.OpenApi.Models;
  using Newtonsoft.Json.Serialization;
  using Microsoft.AspNetCore.Mvc;
  
  namespace TSE.Kalibrasyon.Web.Host.Startup
  {
      public class Startup
      {
          private const string _defaultCorsPolicyName = "localhost";
  
          private readonly IConfigurationRoot _appConfiguration;
  
          public Startup(IWebHostEnvironment env)
          {
              _appConfiguration = env.GetAppConfiguration();
          }
  
          public IServiceProvider ConfigureServices(IServiceCollection services)
          {
              //MVC
              services.AddControllersWithViews(
                  options =&gt;
                  {
                      options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());
                  }
              ).AddNewtonsoftJson(options =&gt;
              {
                  //options.SerializerSettings.ContractResolver = new AbpMvcContractResolver(IocManager.Instance)
                  //{
                  //    NamingStrategy = new CamelCaseNamingStrategy()
                  //};
                  options.SerializerSettings.ContractResolver = new DefaultContractResolver();
              });
  
  
              services.PostConfigure&lt;MvcNewtonsoftJsonOptions&gt;(options =&gt;
              {
                  options.SerializerSettings.ContractResolver = new DefaultContractResolver();
              });
  
  
  
              IdentityRegistrar.Register(services);
              AuthConfigurer.Configure(services, _appConfiguration);
  
              services.AddSignalR();
  
              // Configure CORS for angular2 UI
              services.AddCors(
                  options =&gt; options.AddPolicy(
                      _defaultCorsPolicyName,
                      builder =&gt; builder
                          .WithOrigins(
                              // App:CorsOrigins in appsettings.json can contain more than one address separated by comma.
                              _appConfiguration["App:CorsOrigins"]
                                  .Split(",", StringSplitOptions.RemoveEmptyEntries)
                                  .Select(o =&gt; o.RemovePostFix("/"))
                                  .ToArray()
                          )
                          .AllowAnyHeader()
                          .AllowAnyMethod()
                          .AllowCredentials()
                  )
              );
  
              // Swagger - Enable this line and the related lines in Configure method to enable swagger UI
              services.AddSwaggerGen(options =&gt;
              {
                  options.SwaggerDoc("v1", new OpenApiInfo() { Title = "Kalibrasyon API", Version = "v1" });
                  options.DocInclusionPredicate((docName, description) =&gt; true);
  
                  // Define the BearerAuth scheme that's in use
                  options.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme()
                  {
                      Description = "JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"",
                      Name = "Authorization",
                      In = ParameterLocation.Header,
                      Type = SecuritySchemeType.ApiKey
                  });
              });
  
              // Configure Abp and Dependency Injection
              return services.AddAbp&lt;KalibrasyonWebHostModule&gt;(
                  // Configure Log4Net logging
                  options =&gt; options.IocManager.IocContainer.AddFacility&lt;LoggingFacility&gt;(
                      f =&gt; f.UseAbpLog4Net().WithConfig("log4net.config")
                  )
              );
          }
  
          public void Configure(IApplicationBuilder app,  ILoggerFactory loggerFactory)
          {
              app.UseAbp(options =&gt; { options.UseAbpRequestLocalization = false; }); // Initializes ABP framework.
  
              app.UseCors(_defaultCorsPolicyName); // Enable CORS!
  
              app.UseStaticFiles();
  
              app.UseRouting();
  
              app.UseAuthentication();
  
              app.UseAbpRequestLocalization();
  
  
              app.UseEndpoints(endpoints =&gt;
              {
                  endpoints.MapHub&lt;AbpCommonHub&gt;("/signalr");
                  endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
                  endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
              });
  
              // Enable middleware to serve generated Swagger as a JSON endpoint
              app.UseSwagger();
              // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
              app.UseSwaggerUI(options =&gt;
              {
                  options.SwaggerEndpoint(_appConfiguration["App:ServerRootAddress"].EnsureEndsWith('/') + "swagger/v1/swagger.json", "Kalibrasyon API V1");
                  options.IndexStream = () =&gt; Assembly.GetExecutingAssembly()
                      .GetManifestResourceStream("TSE.Kalibrasyon.Web.Host.wwwroot.swagger.ui.index.html");
              }); // URL: /swagger
          }
      }
  }
  </code></pre>
  
  <p>Is there any solution that you might know? Thanks in advance.</p>
  
  <p>and also, Controlling serialization of property names with JsonResult. But no use.Any idea please?</p>