---
title: "CamelCase not working in net core 6 web api"  
description: "CamelCase not working in net core 6 web api"  
author: "Sandra Emily"  
published: 2023-11-07  
updated: 2023-11-08  
canonical: https://www.mindstick.com/forum/160464/camelcase-not-working-in-net-core-6-web-api  
category: ".net core"  
tags: ["asp.net core", ".net core", ".net core 6"]  
reading_time: 1 minute  

---

# CamelCase not working in net core 6 web api

CamelCase not working in [net core](https://www.mindstick.com/forum/160454/how-to-run-migration-automatically-in-program-cs-in-dot-net-core-6) 6 [web api](https://www.mindstick.com/articles/324352/how-to-create-web-api-in-dot-net-core-3-1-mvc).

## Replies

### Reply by Aryan Kumar

If camelCase property names are not being used in the JSON responses of your ASP.[NET](https://www.mindstick.com/articles/23172/login-mywifiext-net-and-setup-your-extender-by-the-advice-of-an-expert) Core 6 [Web](https://www.mindstick.com/articles/12783/the-ultimate-bunch-of-free-web-design-resources) API, it's likely because the default JSON serialization settings are set to use PascalCase by default. To make your API use camelCase property names, you can configure the JSON serialization settings as follows:

1. In your **Startup.cs** file, within the **ConfigureServices** method, configure the JSON serializer to use camelCase:

```plaintext
services.AddControllers()
    .AddJsonOptions(options =>
    {
        options.JsonSerializerOptions.PropertyNamingPolicy = null; // Use the default naming policy
    });
```

1. Alternatively, you can set **options.JsonSerializerOptions.PropertyNamingPolicy** to **JsonNamingPolicy.CamelCase** to explicitly specify camelCase:

```plaintext
services.AddControllers()
    .AddJsonOptions(options =>
    {
        options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; // Use camelCase naming policy
    });
```

Either of the above methods will configure the JSON serialization settings to use camelCase for property names. Your API will now return JSON responses with camelCase property names. Make sure you have added the necessary **Microsoft.AspNetCore.Mvc.NewtonsoftJson** NuGet package and added it to your project if you prefer using Newtonsoft.Json for serialization.


---

Original Source: https://www.mindstick.com/forum/160464/camelcase-not-working-in-net-core-6-web-api

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
