<PackageReference Include="Refit" Version="15.0.0-beta.1" />

Refit.SystemTextJsonContentSerializer

A class implementing IHttpContentSerializer using the System.Text.Json APIs.

Gets the JSON serialization options this serializer uses, exposed so a query converter can walk a registered type's JsonTypeInfo without reflection.

A class implementing IHttpContentSerializer using the System.Text.Json APIs.

Initializes a new instance of the SystemTextJsonContentSerializer class.

Creates new JsonSerializerOptions and fills it with default parameters.

Creates JsonSerializerOptions that are eligible for the System.Text.Json source-generated fast-path on serialization. Unlike GetDefaultJsonSerializerOptions, these options add no converters and do not set NumberHandling, both of which disable the fast-path. Assign a source-generated TypeInfoResolver (a JsonSerializerContext generated in Serialization or Default mode) to enable it. The fast-path runs through the synchronous serialization primitives (SerializeToUtf8Bytes / Serialize(Utf8JsonWriter, ...)); only the built-in SerializeAsync(Stream) (used by JsonContent) bypasses it for the metadata logic.

public T DeserializeFromString<T>(string content)

public IAsyncEnumerable<T> DeserializeStreamAsync<T>(Stream stream, StreamingContentFormat format, CancellationToken cancellationToken = default)

public Task<T> FromHttpContentAsync<T>(HttpContent content, CancellationToken cancellationToken = default)

public string GetFieldNameForProperty(PropertyInfo propertyInfo)

Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands.

public HttpContent ToHttpContent<T>(T item)