https://github.com/nogic1008/jsonconverters
Converters for System.Text.Json
https://github.com/nogic1008/jsonconverters
csharp dotnet json
Last synced: 4 months ago
JSON representation
Converters for System.Text.Json
- Host: GitHub
- URL: https://github.com/nogic1008/jsonconverters
- Owner: nogic1008
- License: mit
- Created: 2022-01-14T02:19:30.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-15T23:46:18.000Z (about 1 year ago)
- Last Synced: 2025-09-11T10:53:45.839Z (10 months ago)
- Topics: csharp, dotnet, json
- Language: C#
- Homepage:
- Size: 243 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nogic.JsonConverters
[](https://github.com/nogic1008/JsonConverters/releases)
[](https://github.com/nogic1008/JsonConverters/actions/workflows/dotnet.yml)
[](https://codecov.io/gh/nogic1008/JsonConverters)
[](https://www.codefactor.io/repository/github/nogic1008/JsonConverters)
[](LICENSE)
Converters for `System.Text.Json`
## Features
### Converter
For use, see [Register a custom converter](https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/converters-how-to#register-a-custom-converter).
#### `DateOnlyConverter`, `TimeOnlyConverter`
> [!IMPORTANT]
> *Obsolete*: Use built-in [`DateOnlyConverter`](https://github.com/dotnet/runtime/blob/v7.0.0/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/DateOnlyConverter.cs) and [`TimeOnlyConverter`](https://github.com/dotnet/runtime/blob/v7.0.0/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Value/TimeOnlyConverter.cs) on `System.Text.Json@7.0.0` (.NET 7.0) or higher.
Implementation of `JsonConverter` and `JsonConverter`.
#### `EnumStringConverterFactory`, `EnumStringConverter`
> [!IMPORTANT]
> *Obsolete*: Use built-in [`JsonStringEnumMemberNameAttribute`](https://learn.microsoft.com/dotnet/api/system.text.json.serialization.jsonstringenummembernameattribute) on `System.Text.Json@9.0.0` (.NET 9.0) or higher.
Implementation of `JsonConverterFactory` for `enum` that uses `JsonPropertyNameAttribute` and [`EnumMemberAttribute`](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.enummemberattribute)
#### `BlankNullableConverterFactory`, `BlankNullableConverter`
Implementation of `JsonConverterFactory` for `Nullable` that treats `""` as `null`.
### JsonNamingPolicy
> [!IMPORTANT]
> *Obsolete*: Use built-in [`JsonNamingPolicy`](https://learn.microsoft.com/dotnet/api/system.text.json.jsonnamingpolicy) on `System.Text.Json@8.0.0` (.NET 8.0) or higher.
See also [Use a custom JSON property naming policy](https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/customize-properties#use-a-custom-json-property-naming-policy).
- `JsonLowerSnakeCaseNamingPolicy`
- Convert property name to `snake_case`
- `JsonUpperSnakeCaseNamingPolicy`
- Convert property name to `SNAKE_CASE`
- `JsonKebabCaseNamingPolicy`
- Convert property name to `kebab-case`