System.Text.Json: The polymorphism attributes do not appear to work with nested objects
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
### 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](https://github.com/dotnet/docs/issues?q=is%3Aissue+is%3Aopen+17511810-6572-ad88-6eaf-4f9bded720b7)
Contributor guide
Assessment
This issue has not been assessed yet.