Skip to main content

ParallelModelResponseExtensions.AsTyped<TData> method

Converts the JSON data of an untyped response to the specified reference type while preserving the original status code, response text and headers.

public static ParallelModelResponse<TData> AsTyped<TData>(this ParallelModelResponse response,
JsonSerializerOptions? options = null)
where TData : class
parameterdescription
TDataThe reference type into which the JSON data is deserialized.
responseThe untyped API response to convert.
optionsOptional JSON serializer settings. A copy is used when supplied, so the original settings are not modified.

Return Value​

A strongly typed response containing the deserialized data, or null data when the original JSON is absent, undefined or null.

Exceptions​

exceptioncondition
ArgumentNullExceptionThe response is null.
JsonExceptionThe JSON data cannot be deserialized into the specified type.
NotSupportedExceptionNo compatible converter is available for the requested type or one of its members.

Remarks​

A flexible GUID converter is inserted at the beginning of the serializer converter collection before deserialization.

See Also​