A payload is data carried with a request. In HTTP, the request body can contain submitted data such as form contents or JSON; minimal APIs commonly use JSON bodies to provide data to an endpoint. section 1.4.1 section 7.3
When a minimal API receives a JSON payload:
- ASP.NET Core deserializes the body into one complex handler parameter. section 7.3
- The endpoint can use the resulting object without manually parsing the JSON. section 5.2.3
- System.Text.Json performs deserialization, and its behavior can be configured for options such as naming policy, case sensitivity, and trailing commas. section 7.3
A product JSON payload
A POST request to /product can carry { "id": 1, "Name": "Shoes", "Stock": 12 }. A handler receiving a Product parameter gets the deserialized object. section 7.3
Listing 7.3 Automatically deserializing a JSON request from the body
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
WebApplication app = builder.Build();
app.MapPost("/product", (Product product) => $"Received {product}"); #1
app.Run();
record Product(int Id, string Name, int Stock); #2
See the compact minimal API example that accepts a Product object from a JSON request body. section 7.3







