Class JsonDataAttribute
Specifies that a parameter of a controller method will receive an object obtained by deserializing the request body as JSON.
The received object will be null
only if the deserialized object is null
.
If the request body is not valid JSON,
or if it cannot be deserialized to the type of the parameter,
a 400 Bad Request
response will be sent to the client.
This class cannot be inherited.
Implements
Namespace: EmbedIO.WebApi
Syntax
public class JsonDataAttribute : Attribute, IRequestDataAttribute<WebApiController>
Methods
GetRequestDataAsync(WebApiController, Type, String)
Asynchronously obtains data from a controller's context.
Declaration
public Task<object> GetRequestDataAsync(WebApiController controller, Type type, string parameterName)
Parameters
Type | Name | Description |
---|---|---|
WebApiController | controller | |
Type | type | The type of the parameter that has to receive the data. |
String | parameterName | The name of the parameter that has to receive the data. |
Returns
Type | Description |
---|---|
Task<Object> | a |
Implements
See Also
IRequestDataAttribute<TController>