We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题相关类 System.Text.Json.JsonSerializer System.Text.Json.Serialization.JsonStringEnumConverter
无法读取通过JsonStringEnumConverter转换器读取到枚举JsonPropertyNameAttribute特性属性名
using System.Runtime.Serialization; using System.Text.Json; using System.Text.Json.Serialization; Console.WriteLine(JsonSerializer.Serialize(new Test(), new JsonSerializerOptions() { WriteIndented = true })); ; public class Test { [JsonPropertyName("data1")] public DataType Days1 => DataType.TestData1; [JsonPropertyName("data2")] public DataType Days2 => DataType.TestData2; [JsonPropertyName("data3")] public DataType Days3 => DataType.TestData3; } [JsonConverter(typeof(JsonStringEnumConverter))] public enum DataType { [JsonPropertyName("testData1")] [EnumMember(Value = "testData1")] TestData1, [JsonPropertyName("testData2")] [EnumMember(Value = "testData2")] TestData2, TestData3, };
{ "data1": "TestData1", "data2": "TestData2", "data3": "TestData3" }
{ "data1": "testData1", "data2": "testData2", "data3": "TestData3" }
略...
No response
添加对 JsonStringEnumConverter 的 JsonPropertyNameAttribute 的读取支持
The text was updated successfully, but these errors were encountered:
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis See info in area-owners.md if you want to be subscribed.
area-System.Text.Json
Sorry, something went wrong.
Duplicate of #74385.
No branches or pull requests
Description
问题相关类
System.Text.Json.JsonSerializer
System.Text.Json.Serialization.JsonStringEnumConverter
无法读取通过JsonStringEnumConverter转换器读取到枚举JsonPropertyNameAttribute特性属性名
Reproduction Steps
Expected behavior
源 JSON 结果
预期 JSON 结果
Actual behavior
略...
Regression?
No response
Known Workarounds
添加对 JsonStringEnumConverter 的 JsonPropertyNameAttribute 的读取支持
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: