FromBody attribute
The FromBody attribute directs ASP.NET Core model binding to deserialize a parameter or property value from the HTTP request body.
ASP.NET Core in Action, 3e
The FromBody attribute is an ASP.NET Core parameter-binding attribute that specifies binding a parameter from the deserialized HTTP request body.
- How it is used
- Directs ASP.NET Core model binding to obtain a parameter from JSON content in an HTTP request body.
- How deep it goes
- Explains JSON deserialization, binding-source precedence, media-type failures, verb restrictions, and multiple-body-parameter errors.
- Examples
- Uses a Product record in a POST endpoint and a List<Photo> parameter in a Razor Pages handler.
- What you can do after
- Apply it via ASP.NET Core handler parameters to select JSON body binding and avoid common request-shape errors.
Read how ASP.NET Core in Action, 3e explains FromBody attribute →
Pro ASP.NET Core 7, Tenth Edition
The FromBody attribute is an ASP.NET Core parameter attribute that specifies that a parameter value should be read from the HTTP request body.
- How it is used
- Selects the HTTP request body as the model-binding source for an action parameter receiving JSON.
- How deep it goes
- Shows parameter placement and a working POST request, but defers the complexities of model binding and data validation.
- Examples
- Uses Product actions and PowerShell JSON POST and PUT requests, including a POST whose bound object is returned.
- What you can do after
- Apply it via ASP.NET Core MVC to bind a JSON request body to a controller action parameter.
Read how Pro ASP.NET Core 7, Tenth Edition explains FromBody attribute →
What to know first
- dependency injectionDependency injection is a software design technique in which a component receives its dependencies from outside rather than creating or locating them internally.
- form dataForm data is a collection of named values associated with form controls for submission or processing.
- JSONJSON is a language-independent text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.
- model bindingModel binding is the process of locating incoming data, converting it to appropriate types, and assigning it to application objects or handler parameters.
Related concepts
- ApiControllercontrasts with · ApiController is an ASP.NET Core attribute that enables API-specific conventions and behavior for controller classes, including request binding and validation handling.
- payloadconfigures · A payload is the substantive data or code carried or delivered by a message, request, token, or other system component, apart from its descriptive or control information.
- model bindingconfigures · Model binding is the process of locating incoming data, converting it to appropriate types, and assigning it to application objects or handler parameters.
Questions about FromBody attribute
What is FromBody attribute?
The FromBody attribute directs ASP.NET Core model binding to deserialize a parameter or property value from the HTTP request body.
Which Manning books explain FromBody attribute?
ASP.NET Core in Action, 3e and Pro ASP.NET Core 7, Tenth Edition.
What should I know before learning FromBody attribute?
Manning books that teach FromBody attribute usually introduce dependency injection, form data, JSON and model binding first.
What is the difference between FromBody attribute and ApiController?
The FromBody attribute directs ASP.NET Core model binding to deserialize a parameter or property value from the HTTP request body. ApiController is an ASP.NET Core attribute that enables API-specific conventions and behavior for controller classes, including request binding and validation handling.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

