There's the project, that has Node class declared
public class Node
{
public string id { get; set; }
public int group { get; set; }
public Node( string id, int group)
{
this.id = id;
this.group = group;
}
public Node()
{
}
}
And method, that has to receive this object and do stuff with it
[HttpPost]
public IActionResult Create(Node node)
{
//does stuff here
return NoContent();
}
One thing I can't understand is how my JSON object has to look like to be correctly deserialized in this method. I mean I tried to send JSON that looked like this: { "id": "TEST", "group": 1} but thing received object with id = null, group = 0. I don't get it, what do I do wrong?