Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jscarle/systemtextjsoncustomenumserialization
Comparing different methods of serializing and deserializing custom enum values using System.Text.Json in .NET.
https://github.com/jscarle/systemtextjsoncustomenumserialization
csharp deserialization dotnet enum json serialization system-text-json
Last synced: 25 days ago
JSON representation
Comparing different methods of serializing and deserializing custom enum values using System.Text.Json in .NET.
- Host: GitHub
- URL: https://github.com/jscarle/systemtextjsoncustomenumserialization
- Owner: jscarle
- License: mit
- Created: 2024-04-03T12:36:18.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-21T22:55:08.000Z (9 months ago)
- Last Synced: 2024-04-22T02:28:36.536Z (9 months ago)
- Topics: csharp, deserialization, dotnet, enum, json, serialization, system-text-json
- Language: C#
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# System.Text.Json Custom Enum Serialization
Comparing different methods of serializing and deserializing custom enum values using [System.Text.Json](https://learn.microsoft.com/en-us/dotnet/api/system.text.json).
- Using the default `JsonSerializer` (see [source](https://github.com/jscarle/SystemTextJsonCustomEnumSerialization/blob/main/EnumSerialization.Tests/Default)📄).
- Using a reflection based `JsonConverter` (see [source](https://github.com/jscarle/SystemTextJsonCustomEnumSerialization/tree/main/EnumSerialization.Tests/Reflection)📄).
- Using an AOT compatible `JsonStringEnumConverter` with [source generation](https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation)
as explained by [Eirik Tsarpalis](https://github.com/eiriktsarpalis) in this [comment](https://github.com/dotnet/runtime/issues/74385#issuecomment-1705083109) (see [source](https://github.com/jscarle/SystemTextJsonCustomEnumSerialization/tree/main/EnumSerialization.Tests/Aot)📄).![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/jscarle/SystemTextJsonCustomEnumSerialization/main.yml?logo=github&label=tests)