Methods for receiving JSON data in an Asp.NET core Controller
-
[HttpPost] public IActionResult Fill([FromBody] dynamic data) { string amount = data.amount.GetString(); }
-
[HttpPost] public IActionResult Fill() { string dataStr = new StreamReader(Request.Body, Encoding.UTF8).ReadToEnd(); var data = JObject.Parse(dataStr); string amount = data.value.amount; }
-
[HttpPost] public IActionResult Fill([FromBody] YourType data) { string amount = data.amount; }