I have an API request that goes off and the response structure back looks like this:
{
"MessageBody": {
"foo" : ""
}
}
The properties under MessageBody
can be anything, not only foo
, but its value is always a string.
eg. {"MessageBody": { "Token": "abc" }}
or {"MessageBody": { "Name": "abc" }}
How can I capture this response from the API as a generic object
for the property under MessageBody
?
I can represent the first example above as:
public class MessageBody
{
public string Token { get; set; }
}
How would I represent both Token
or Name
properties under the same MessageBody
object? There's a bunch of different values that MessageBody
can have, but again they would all be of type string
.