Let's say I have a controller which accepts the following JSON:
{ "propA": "val1", "propB": { "propC": "valC", "propD": "valD" }, "propE", "valE" }
Without using a custom serializer, is there a way to deserialize this JSON into a class such as:
public record Payload( string PropA, string PropC, string PropD, string PropE );
The JSON object "PropB" should be unwrapped, and the two child attributes "PropC" and "PropD" mapped directly to the corresponding properties of the class.
I'm using the built-in JSON classes from System.Text
.
没有评论:
发表评论