Skip to main content

Response.Json method

Creates a JSON response from text that is already JSON, sent as UTF-8 with the content type application/json.

public static Response Json(string json, ushort status = 200)
parameterdescription
jsonThe JSON text. It is sent as it is: serialize an object first, for example with JsonSerializer.Serialize. The text is not checked for being valid JSON.
statusThe HTTP status code.

Examples​

return Response.Json(JsonSerializer.Serialize(greeting, AppJson.Default.Greeting));

See Also​