JsonBodyProvider 10.0.1

Suggested Alternatives

VanDerHeijden.JsonBodyProvider

Additional Details

Switched name only

dotnet add package JsonBodyProvider --version 10.0.1
                    
NuGet\Install-Package JsonBodyProvider -Version 10.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JsonBodyProvider" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JsonBodyProvider" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="JsonBodyProvider" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add JsonBodyProvider --version 10.0.1
                    
#r "nuget: JsonBodyProvider, 10.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package JsonBodyProvider@10.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=JsonBodyProvider&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=JsonBodyProvider&version=10.0.1
                    
Install as a Cake Tool

JsonBodyProvider

ASP.NET Core custom value provider
Allows you to bind multiple simple parameters directly from a JSON request body — without using [FromBody] and without wrapper DTO classes.

Main purpose
Call controller actions like this:

[HttpPost]
public IActionResult CreateUser(
    string Name,
    int Age,
    List<string> Roles,
    Guid TenantId,
    DateOnly StartDate,
    bool IsActive,
    string? Comment = null)
{
    // ← all parameters automatically come from JSON body
}

Most important facts first

Works only without [ApiController] attribute
[ApiController] breaks this completely → remove it from the controller

Installation

dotnet add package JsonBodyProvider
builder.Services
    .AddControllers()                       // ← no [ApiController] !
    .AddJsonProviders(CorrectLists: true);  // ← enables nice list + string behaviour

Good real-world examples

Example 1 – Classic user creation

[Route("api/users")]
public class UsersController : ControllerBase
{
    [HttpPost]
    public IActionResult Create(
        string Name,
        int Age,
        string Email,
        List<string> Roles,
        bool IsActive = true)
    {
        // ...
    }
}
POST /api/users
Content-Type: application/json

{
  "name": "Lisa van Dijk",
  "age": 34,
  "email": "lisa@example.com",
  "roles": ["editor", "reviewer"],
  "isActive": true
}

Example 2 – Order with items

[HttpPost("orders")]
public IActionResult PlaceOrder(
    string OrderNumber,
    DateOnly OrderDate,
    decimal TotalAmount,
    List<string> ProductCodes,
    Guid CustomerId,
    string? Remark = null)
{
    // ...
}
{
  "orderNumber": "ORD-2025-78412",
  "orderDate": "2025-06-18",
  "totalAmount": 1249.95,
  "productCodes": ["PROD-A42", "PROD-B17", "PROD-C09"],
  "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "remark": ""
}

Example 3 – Very flat analytics event

[HttpPost("events")]
public IActionResult TrackEvent(
    string EventName,
    string UserId,
    DateTime Timestamp,
    int Value,
    Dictionary<string, string> Properties,
    bool IsConversion,
    Guid? CampaignId)
{
    // ...
}
{
  "eventName": "purchase_completed",
  "userId": "usr_9k3j2p8x",
  "timestamp": "2025-06-18T14:22:09Z",
  "value": 1,
  "properties": {
    "category": "electronics",
    "source": "newsletter"
  },
  "isConversion": true,
  "campaignId": null
}

Example 4 – Very minimal update

[HttpPatch("items/{id}")]
public IActionResult PatchItem(
    Guid id,
    string? Title,
    string? Description,
    bool? Active,
    int? Priority)
{
    // only the fields that are sent will be bound
}
{
  "title": "Updated task name",
  "priority": 3
}

What you get for free

  • Multiple parameters from one JSON body
  • No need for [FromBody] on every parameter
  • No wrapper DTO needed
  • Empty strings stay empty strings
  • Lists behave nicely (no random fallback to default(T) on parse errors)
  • Headers and cookies are also available as parameters

Golden rule (repeat until it hurts)

Do NOT use [ApiController] on controllers where you want to use this package

If you really need [ApiController] → you cannot use this style of multi-parameter binding

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 113 2/16/2026 10.0.1 is deprecated because it is no longer maintained.