liveBook · Manning

Payload

As explained in ASP.NET Core in Action, 3e

A JWT payload is the token section that contains its claims and other encoded data.

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

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains request-body binding, automatic deserialization, and serializer options, while deferring detailed model binding.
Examples
Uses Product and Fruit records, JSON objects, POST requests, and minimal API handler parameters as concrete payload examples.
What it assumes
Assumes basic HTTP requests and introduces JSON body binding through small minimal API examples.
What you can do after
Apply it via ASP.NET Core minimal APIs by sending JSON and receiving the deserialized complex object in a handler.
How it connects
Connects HTTP requests with JSON, request bodies, minimal APIs, model binding, and System.Text.Json.

Also explained in

Compare how 8 books explain payload →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.