KestrunResponse.WriteJsonResponse method (1 of 3)

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

public void WriteJsonResponse(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.WriteJsonResponse method (2 of 3)

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

public void WriteJsonResponse(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.WriteJsonResponse method (3 of 3)

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

public void WriteJsonResponse(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