✅ Binding Nested values in RequestBody to Model
Consider the following model I use inside the MVC structure:
However, when responding to requests, this is instead formatted as
As you can see, the property
Now I would like to receive a Collection in a
to my Model.
I've read online that Model Binding is probably the solution to this, but the vast majority of examples and explanations I could find were centered around Routes / Query parameters, not RequestBody formatting.
The part I did find mentioned ValueProviders, but I couldn't find out how to obtain the JSON data from the body and store it as keys there.
Any suggestions are appreciated, as I'm rather new to MVC architecture and C# in general.
However, when responding to requests, this is instead formatted as
application/hal+json, which would look like this:As you can see, the property
Url has been moved into _links:external:href.Now I would like to receive a Collection in a
[HttpPut] request, but I'm having trouble figuring out how to properly parse the incoming application/hal+jsonto my Model.
I've read online that Model Binding is probably the solution to this, but the vast majority of examples and explanations I could find were centered around Routes / Query parameters, not RequestBody formatting.
The part I did find mentioned ValueProviders, but I couldn't find out how to obtain the JSON data from the body and store it as keys there.
Any suggestions are appreciated, as I'm rather new to MVC architecture and C# in general.