HttpResponseDataExtensions.WriteAsJsonAsync Method

Definition

Overloads

WriteAsJsonAsync<T>(HttpResponseData, T, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to application/json; charset=utf-8 and the status code set to 200.

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to application/json; charset=utf-8 and the status code set to 200.

WriteAsJsonAsync<T>(HttpResponseData, T, HttpStatusCode, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to application/json; charset=utf-8 and the status code set to the provided statusCode.

WriteAsJsonAsync<T>(HttpResponseData, T, String, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to the provided contentType and the status code set to 200.

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, HttpStatusCode, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to application/json; charset=utf-8 and the status code set to the provided statusCode.

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, String, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to the provided contentType and the status code set to 200.

WriteAsJsonAsync<T>(HttpResponseData, T, String, HttpStatusCode, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to the provided contentType and the status code set to the provided statusCode.

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, String, HttpStatusCode, CancellationToken)

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to the provided contentType and the status code set to the provided statusCode.

WriteAsJsonAsync<T>(HttpResponseData, T, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to application/json; charset=utf-8 and the status code set to 200.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to application/json; charset=utf-8 and the status code set to 200.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * Azure.Core.Serialization.ObjectSerializer * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, serializer As ObjectSerializer, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

serializer
ObjectSerializer

The serializer used to serialize the instance.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, HttpStatusCode, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to application/json; charset=utf-8 and the status code set to the provided statusCode.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, System.Net.HttpStatusCode statusCode, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * System.Net.HttpStatusCode * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, statusCode As HttpStatusCode, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

statusCode
HttpStatusCode

The status code to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, String, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to the provided contentType and the status code set to 200.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, string contentType, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, contentType As String, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

contentType
String

The content-type to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, HttpStatusCode, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to application/json; charset=utf-8 and the status code set to the provided statusCode.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, Azure.Core.Serialization.ObjectSerializer serializer, System.Net.HttpStatusCode statusCode, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * Azure.Core.Serialization.ObjectSerializer * System.Net.HttpStatusCode * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, serializer As ObjectSerializer, statusCode As HttpStatusCode, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

serializer
ObjectSerializer

The serializer used to serialize the instance.

statusCode
HttpStatusCode

The status code to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, String, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to the provided contentType and the status code set to 200.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, Azure.Core.Serialization.ObjectSerializer serializer, string contentType, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * Azure.Core.Serialization.ObjectSerializer * string * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, serializer As ObjectSerializer, contentType As String, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

serializer
ObjectSerializer

The serializer used to serialize the instance.

contentType
String

The content-type to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, String, HttpStatusCode, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the default ObjectSerializer configured for this worker. The response content-type will be set to the provided contentType and the status code set to the provided statusCode.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, string contentType, System.Net.HttpStatusCode statusCode, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * string * System.Net.HttpStatusCode * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, contentType As String, statusCode As HttpStatusCode, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

contentType
String

The content-type to set on the response.

statusCode
HttpStatusCode

The status code to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to

WriteAsJsonAsync<T>(HttpResponseData, T, ObjectSerializer, String, HttpStatusCode, CancellationToken)

Source:
HttpResponseDataExtensions.cs

Asynchronously writes the specified value as JSON to the response body using the provided ObjectSerializer. The response content-type will be set to the provided contentType and the status code set to the provided statusCode.

public static System.Threading.Tasks.ValueTask WriteAsJsonAsync<T> (this Microsoft.Azure.Functions.Worker.Http.HttpResponseData response, T instance, Azure.Core.Serialization.ObjectSerializer serializer, string contentType, System.Net.HttpStatusCode statusCode, System.Threading.CancellationToken cancellationToken = default);
static member WriteAsJsonAsync : Microsoft.Azure.Functions.Worker.Http.HttpResponseData * 'T * Azure.Core.Serialization.ObjectSerializer * string * System.Net.HttpStatusCode * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
<Extension()>
Public Function WriteAsJsonAsync(Of T) (response As HttpResponseData, instance As T, serializer As ObjectSerializer, contentType As String, statusCode As HttpStatusCode, Optional cancellationToken As CancellationToken = Nothing) As ValueTask

Type Parameters

T

The type of object to write.

Parameters

response
HttpResponseData

The response to write JSON to.

instance
T

The instance to serialize and write as JSON.

serializer
ObjectSerializer

The serializer used to serialize the instance.

contentType
String

The content-type to set on the response.

statusCode
HttpStatusCode

The status code to set on the response.

cancellationToken
CancellationToken

A CancellationToken used to cancel the operation.

Returns

A ValueTask that represents the asynchronous operation.

Applies to