Skip to content

Latest commit

 

History

History
32 lines (29 loc) · 890 Bytes

README.md

File metadata and controls

32 lines (29 loc) · 890 Bytes

NuGet

JsonParametersModelBinder

Allows you to map JSON object directly to controller action parameters. Convert JSON model

{ "a": "a", "b": { "c": "value" } }

directly to action method

public ... Method(string a, dynamic b)

Warning

Nested objects are supported as dynamic types (with limitations).

Usage

Step 1. Add attribute JsonParameters to your action

[HttpPost("two")]
[JsonParameters]
public async Task<IActionResult> TwoParameters(string a, dynamic b)
{
    Console.WriteLine(b.c);
    return Ok();
}

Step 2. Enhoy simplified workflow.

Thanks

Thanks to tchivs for providing code to map to dynamic types