Don't know if it is possible but I want to have a different object name in json and in class when I'm calling REST API, e.g. my Json would look like:
{
"JsonName": {
"Prop1": "value1",
"Prop2": "value2",
"Prop3": "value3"
},
"Example": "value4"
}
And I would call a method which would look like:
public async Task<ActionResult<SomeResponse>> PostCodeName(
[FromBody] Wrapper wrapper)
{
// All the code
}
public class Wrapper
{
public SomeClass CodeName{get; set;}
public int Id {get; set;}
}
What I'm asking is basically if it is possible to use JsonName instead of CodeName in json object when calling API (maybe some kind of an attribute? I haven't found anything unfortunately).
Also can I do the same for the Wrapper(different class name but same properties) when consuming API from different app?