Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nogic1008/jsonconverters
Converters for System.Text.Json
https://github.com/nogic1008/jsonconverters
csharp dotnet json
Last synced: 5 days 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 (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-10T23:29:19.000Z (5 days ago)
- Last Synced: 2024-11-11T00:23:58.063Z (5 days ago)
- Topics: csharp, dotnet, json
- Language: C#
- Homepage:
- Size: 270 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nogic.JsonConverters
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/nogic1008/JsonConverters)](https://github.com/nogic1008/JsonConverters/releases)
[![.NET CI](https://github.com/nogic1008/JsonConverters/actions/workflows/dotnet.yml/badge.svg)](https://github.com/nogic1008/JsonConverters/actions/workflows/dotnet.yml)
[![codecov](https://codecov.io/gh/nogic1008/JsonConverters/branch/master/graph/badge.svg?token=wkwjZuMLHC)](https://codecov.io/gh/nogic1008/JsonConverters)
[![CodeFactor](https://www.codefactor.io/repository/github/nogic1008/JsonConverters/badge)](https://www.codefactor.io/repository/github/nogic1008/JsonConverters)
[![License](https://img.shields.io/github/license/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 `[email protected]` (.NET 7.0) or higher.Implementation of `JsonConverter` and `JsonConverter`.
#### `EnumStringConverterFactory`, `EnumStringConverter`
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 `[email protected]` (.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`