5 instantiations of JsonHttpResult
Microsoft.AspNetCore.Http.Results (5)
Results.cs (2)
203return new JsonHttpResult<object>(data, statusCode, contentType) { JsonTypeInfo = jsonTypeInfo }; 222return new JsonHttpResult<object>(data, statusCode, contentType)
TypedResults.cs (3)
200=> new(data, options, statusCode, contentType); 217return new(data, statusCode, contentType) { JsonTypeInfo = jsonTypeInfo }; 235return new(data, statusCode, contentType)
43 references to JsonHttpResult
Microsoft.AspNetCore.Http.Results (15)
Results.cs (6)
179/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 195/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 214/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 235/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 252/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 268/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/>
TypedResults.cs (9)
186/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 195/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 199public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonSerializerOptions? options = null, string? contentType = null, int? statusCode = null) 203/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 210/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 213public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonTypeInfo<TValue> jsonTypeInfo, string? contentType = null, int? statusCode = null) 221/// Creates a <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> object to JSON. 228/// <returns>The created <see cref="JsonHttpResult{TValue}"/> that serializes the specified <paramref name="data"/> 231public static JsonHttpResult<TValue> Json<TValue>(TValue? data, JsonSerializerContext context, string? contentType = null, int? statusCode = null)
Microsoft.AspNetCore.Http.Results.Tests (28)
JsonResultTests.cs (9)
23var result = new JsonHttpResult<object>(value: null, statusCode: 411, jsonSerializerOptions: null); 41var result = new JsonHttpResult<object>(value: null, statusCode: 407, jsonSerializerOptions: null); 59var result = new JsonHttpResult<string>(value: "Hello", statusCode: 407, jsonSerializerOptions: null); 87var result = new JsonHttpResult<object>(value, jsonSerializerOptions: jsonOptions); 120var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: SerializerOptions); 149var result = new JsonHttpResult<HttpValidationProblemDetails>(details, jsonSerializerOptions: SerializerOptions); 210var result = new JsonHttpResult<HttpValidationProblemDetails>(details, jsonSerializerOptions: null, StatusCodes.Status422UnprocessableEntity); 229var result = new JsonHttpResult<ProblemDetails>(details, jsonSerializerOptions: null); 249var 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>; 1680(() => 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);