I parse a big json file with JsonPolymorphic of System.Text.Json. The json is a audit log and is generated by a third party and I have no control over it. I am only interested in a small part of the file.
I use the Operation
property of the json as type discriminator I set IgnoreUnrecognizedTypeDiscriminators
to true
so all objects I am not interested in are put into the base class. Since I have no control, over the json I could happen that a new Operation
is generated. I like to check against a list of know Operations if this is unknown. But when add a Operation
to my base type, it is always null.
Is there a way to get the Type Discriminator property value for values that are not matching any derived type?