5 instantiations of JsonHttpResult
Microsoft.AspNetCore.Http.Results (5)
Results.cs (2)
204return new JsonHttpResult<object>(data, statusCode, contentType) { JsonTypeInfo = jsonTypeInfo }; 223return new JsonHttpResult<object>(data, statusCode, contentType)
TypedResults.cs (3)
201=> new(data, options, statusCode, contentType); 218return new(data, statusCode, contentType) { JsonTypeInfo = jsonTypeInfo }; 236return new(data, statusCode, contentType)
43 references to JsonHttpResult
Microsoft.AspNetCore.Http.Results (15)
Results.cs (6)
180/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 196/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 215/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 236/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 253/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 269/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/>
TypedResults.cs (9)
187/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 196/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 200public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonSerializerOptions? options = null, string? contentType = null, int? statusCode = null) 204/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 211/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 214public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonTypeInfo<TValue> jsonTypeInfo, string? contentType = null, int? statusCode = null) 222/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 229/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 232public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonSerializerContext context, string? contentType = null, int? statusCode = null)
Microsoft.AspNetCore.Http.Results.Tests (28)
JsonResultTests.cs (9)
21var result = new JsonHttpResult<object>(value: null, statusCode: 411, jsonSerializerOptions: null); 39var result = new JsonHttpResult<object>(value: null, statusCode: 407, jsonSerializerOptions: null); 57var result = new JsonHttpResult<string>(value: "Hello", statusCode: 407, jsonSerializerOptions: null); 85var result = new JsonHttpResult<object>(value, jsonSerializerOptions: jsonOptions); 118var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: JsonSerializerOptions.Web); 147var result = new JsonHttpResult<HttpValidationProblemDetails>(details, jsonSerializerOptions: JsonSerializerOptions.Web); 208var result = new JsonHttpResult<HttpValidationProblemDetails>(details, jsonSerializerOptions: null, StatusCodes.Status422UnprocessableEntity); 227var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: null); 247var result = new JsonHttpResult<object>(null, jsonSerializerOptions: null, null, null);
ResultsTests.cs (15)
939var result = Results.Json(data, options, contentType, statusCode) as JsonHttpResult<object>; 958var result = Results.Json(data, options, contentType, statusCode) as JsonHttpResult<Todo>; 971var result = Results.Json(null) as JsonHttpResult<object>; 984var result = Results.Json(null, StringJsonContext.Default.String as JsonTypeInfo) as JsonHttpResult<object>; 998var result = Results.Json(null, typeof(string), StringJsonContext.Default) as JsonHttpResult<object>; 1012var result = Results.Json(null, StringJsonContext.Default.String) as JsonHttpResult<string>; 1026var result = Results.Json<string>(null, StringJsonContext.Default) as JsonHttpResult<string>; 1759(() => Results.Json(new(), (JsonSerializerOptions)null, null, null), typeof(JsonHttpResult<object>)),
TypedResultsTests.cs (4)
834var result = TypedResults.Json(data, options, contentType, statusCode); 850var result = TypedResults.Json(data); 866var result = TypedResults.Json(data, ObjectJsonContext.Default.Object); 883var result = TypedResults.Json(data, ObjectJsonContext.Default);