KestrunResponse.WriteJsonResponseAsync method (1 of 3)

Asynchronously writes a JSON response with the specified input object and HTTP status code.

public Task WriteJsonResponseAsync(object? inputObject, int statusCode = 200)
parameter description
inputObject The object to be converted to JSON.
statusCode The HTTP status code for the response.

See Also


KestrunResponse.WriteJsonResponseAsync method (2 of 3)

Asynchronously writes a JSON response using the specified input object and serializer settings.

public Task WriteJsonResponseAsync(object? inputObject, JsonSerializerSettings serializerSettings, 
    int statusCode = 200, string? contentType = null)
parameter description
inputObject The object to be converted to JSON.
serializerSettings The settings to use for JSON serialization.
statusCode The HTTP status code for the response.
contentType The MIME type of the response content.

See Also


KestrunResponse.WriteJsonResponseAsync method (3 of 3)

Asynchronously writes a JSON response with the specified input object, serialization depth, compression option, status code, and content type.

public Task WriteJsonResponseAsync(object? inputObject, int depth, bool compress, 
    int statusCode = 200, string? contentType = null)
parameter description
inputObject The object to be converted to JSON.
depth The maximum depth for JSON serialization.
compress Whether to compress the JSON output (no indentation).
statusCode The HTTP status code for the response.
contentType The MIME type of the response content.

See Also