{"id":24783446,"url":"https://github.com/j0rgeserran0/jsonnamingpolicy","last_synced_at":"2026-03-16T20:02:13.813Z","repository":{"id":81626483,"uuid":"231651484","full_name":"J0rgeSerran0/JsonNamingPolicy","owner":"J0rgeSerran0","description":"Naming policies for System.Text.Json","archived":false,"fork":false,"pushed_at":"2022-09-05T10:10:41.000Z","size":58,"stargazers_count":39,"open_issues_count":2,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-08T22:57:14.595Z","etag":null,"topics":["asp-net-core","asp-net-core-5","asp-net-core-6","json","json-naming-policies","json-naming-policy","kebab-case","kebabcase","net5","net6","netcore3","snake-case","snakecase","system-text-json"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/J0rgeSerran0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-03T19:26:53.000Z","updated_at":"2024-10-08T13:34:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"5deabcbf-2f85-49a0-8595-932f343f39bd","html_url":"https://github.com/J0rgeSerran0/JsonNamingPolicy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J0rgeSerran0%2FJsonNamingPolicy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J0rgeSerran0%2FJsonNamingPolicy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J0rgeSerran0%2FJsonNamingPolicy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/J0rgeSerran0%2FJsonNamingPolicy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/J0rgeSerran0","download_url":"https://codeload.github.com/J0rgeSerran0/JsonNamingPolicy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236176747,"owners_count":19107395,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","asp-net-core-5","asp-net-core-6","json","json-naming-policies","json-naming-policy","kebab-case","kebabcase","net5","net6","netcore3","snake-case","snakecase","system-text-json"],"created_at":"2025-01-29T12:17:10.986Z","updated_at":"2025-10-12T06:32:14.919Z","avatar_url":"https://github.com/J0rgeSerran0.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Namespace](https://img.shields.io/static/v1?label=Namespace\u0026message=System.Text.Json\u0026color=green)\n![JSON Naming Policies](https://img.shields.io/static/v1?label=JSON%20Naming%20Policies\u0026message=kebab-case%20and%20snake_case\u0026color=9cf)\n![Compatibility](https://img.shields.io/static/v1?label=Compatibility\u0026message=.NET%20Core%203.1%20and%20.NET%206\u0026color=success)\n\n\n# JsonNamingPolicy\nNaming policies for [System.Text.Json](https://docs.microsoft.com/en-us/dotnet/api/system.text.json?view=netcore-3.1)\n\nThis GitHub repo contains classes to change the name properties of a JSON into different naming conventions.\n\n\u003e **Update April 5 2022**\n\u003e \n\u003e Unlikely it will be added in .NET 7\n\u003e \n![afbeelding](https://user-images.githubusercontent.com/9028898/187986014-8d87f1f2-4e05-45fb-a256-6a8a802c0486.png)\n\n\n\n\u003e **Update Jul 23 2021**\n\u003e \n\u003e Microsoft has moved the implementation of kebab-case and snake_case to .NET 7\n\u003e\n\u003e ![IMAGE](images/20210723.jpg)\n\u003e\n\u003e Additional information [here](https://github.com/dotnet/runtime/issues/782)\n\n\n## NuGet Package\n\n\u003e **Update Oct 13 2021 - NuGet Package**\n\u003e **NickJohn** published 6 months ago, a NuGet Package with the code I share here.\n\u003e \n\u003e You can incorporate the code easily inside of your developments.\n\u003e \n\u003e You will find this NuGet Package **[here](https://www.nuget.org/packages/JorgeSerrano.Json.JsonSnakeCaseNamingPolicy)**\n\u003e  \n\u003e Thanks a lot **NickeJohn**\n\u003e \n\n## JsonSnakeCaseNamingPolicy\nThis class creates a policy to change the name properties of a JSON into SnakeCase (*snake_case*) used in some programming languages and APIs.\n\n\u003e This code passes the tests that you will find in the [corefx SnakeCaseUnitTests of Microsoft](https://github.com/hez2010/corefx/blob/c54ddc76da61c50576eff92e3add9caf7107f8af/src/System.Text.Json/tests/Serialization/SnakeCaseUnitTests.cs)\n\n### Use\n\n```csharp\nvar options = new JsonSerializerOptions() { PropertyNamingPolicy = new JsonSnakeCaseNamingPolicy() };\nvar person = new Person() { FirstName = \"Jorge\", Birthday = DateTime.UtcNow, MyJobCity = \"Madrid\" };\nvar json = JsonSerializer.Serialize(person, options);\n```\n\n### Result\n\n```csharp\n{\"first_name\":\"Jorge\",\"birthday\":\"2020-01-03T20:00:59.6991482Z\",\"my_job_city\":\"Madrid\"}\n```\n\n## JsonKebabCaseNamingPolicy\nThis class creates a policy to change the name properties of a JSON into KebabCase (*kebab-case*).\n\n### Use\n\n```csharp\nvar options = new JsonSerializerOptions() { PropertyNamingPolicy = new JsonKebabCaseNamingPolicy() };\nvar person = new Person() { FirstName = \"Jorge\", Birthday = DateTime.UtcNow, MyJobCity = \"Madrid\" };\nvar json = JsonSerializer.Serialize(person, options);\n```\n\n### Result\n\n```csharp\n{\"first-name\":\"Jorge\",\"birthday\":\"2020-01-03T20:00:59.6991482Z\",\"my-job-city\":\"Madrid\"}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0rgeserran0%2Fjsonnamingpolicy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj0rgeserran0%2Fjsonnamingpolicy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj0rgeserran0%2Fjsonnamingpolicy/lists"}