Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Member group

RespondJson

Declaring type: HttpContextJsonExtensions
Module: System.Web.Http.Json
Assembly: System.Web.dll

Overloads / Variants

RespondJson

func RespondJson(statusCode: HttpStatusCode, value: object) -> Result<void, JsonError>

Extension from HttpContextJsonExtensions.RespondJson

Configures the status and application/json; charset=utf-8 content atomically. Does not send or close the exchange; Complete still validates status/body rules.

Parameters

Name Type Description
self HttpContext
statusCode HttpStatusCode
value Object

Return value

Result<void, JsonError>

RespondJson

func RespondJson(value: object) -> Result<void, JsonError>

Extension from HttpContextJsonExtensions.RespondJson

Serializes a supported model or DOM and configures status 200 with JSON content. Serialization failure leaves Response unchanged. Call Complete to send.

Parameters

Name Type Description
self HttpContext
value Object

Return value

Result<void, JsonError>