dotnet / dotnet/efcore

JSON: Support [JsonConverter]

Open
#27,828 18 comments 9 reactions 0 assignees View on GitHub
area-json area-query customer-reported needs-design
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

System.Text.Json has [`[JsonConverter]`](https://docs.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverterattribute?view=net-10.0), which can be used with e.g. [`JsonStringEnumConverter`](https://docs.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonstringenumconverter?view=net-6.0) to map CLR enums to strings in the JSON document (or do other conversions).

I'm not sure if we plan to support arbitrary EF value converters for JSON properties (we should probably open an issue for that). If we do, then we could set up the appropriate enum/string converter when we see this attribute.

Originally requested for Npgsql by @sergeyshaykhullin in https://github.com/npgsql/efcore.pg/issues/2325

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.