Skip to content
New issue

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: The polymorphism attributes do not appear to work with nested objects #43575

Open
dcooperch opened this issue Nov 14, 2024 · 0 comments
Labels
dotnet-fundamentals/svc Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged

Comments

@dcooperch
Copy link

dcooperch commented Nov 14, 2024

Type of issue

Missing information

Description

The documentation does not mention anything about nested objects.

Consider the following code:

[JsonPolymorphic]
[JsonDerivedType(typeof(Derived1), typeDiscriminator: "Derived1")]
[JsonDerivedType(typeof(Derived2), typeDiscriminator: "Derived2")]

This only appears to work at the root level model.

Current version:
System.Text.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51

Page URL

https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism

Content source URL

https://github.com/dotnet/docs/blob/main/docs/standard/serialization/system-text-json/polymorphism.md

Document Version Independent Id

17511810-6572-ad88-6eaf-4f9bded720b7

Article author

@gewarren

Metadata

  • ID: 179cc49a-a37d-155e-5ecf-deca4f219a5a
  • Service: dotnet-fundamentals

Related Issues

@dotnetrepoman dotnetrepoman bot added the ⌚ Not Triaged Not triaged label Nov 14, 2024
@issues-automation issues-automation bot added dotnet-fundamentals/svc Pri1 High priority, do before Pri2 and Pri3 labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-fundamentals/svc Pri1 High priority, do before Pri2 and Pri3 ⌚ Not Triaged Not triaged
Projects
None yet
Development

No branches or pull requests

1 participant