So, I have a solution which pulls json from a REST API. The problem is that There are multiple APIs that return the same class name in the response:
eg: /../GetTwoNumbers
The response comes in a JSON message which includes a "result" element with an int with the two numbers
another api might be:
../../GetTwoAddresses
The response comes in a JSON element which includes a "result element" with child nodes like
Address1,
Address2,
City,
State,
Zip
...
I am wondering if there is a way to create an interface that can get both types of "result" elements like this:
public interface IResponse
{
public DateTime DateReceived {get;set;}
public string Process {get;set;}
public Result result {get;set;}
}
If that won't work, I suppose I could create separate interfaces, but is there a way to make the elements from the class I don't want to use nullable -- as I understand you need to implement all elements of an interface.
Thanks for the help