-
I have to deserialize json where one property name can be anything. How can I do this? Example: {
"57690": { ... }
} Where 57690 can also be any other number. But it is the only property at this level. public class Root
{
public SubClass _Random_Number_Here_ { get; set; } // <--- How can I make this 'Universal' to 57690 but also 12345 etc
}
var bla = JsonSerializer.Deserialize<Root>(...); |
Beta Was this translation helpful? Give feedback.
Answered by
samsosa
Oct 22, 2022
Replies: 2 comments 5 replies
-
I would deserialize the object as a dictionary and then access the value that way. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Maybe you can use the [JsonExtensionData] attribute? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Symbai
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe you can use the [JsonExtensionData] attribute?