Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

JSON Serialization Configuration

Flux.REST uses System.Text.Json to serialize request bodies and deserialize response bodies.

Each Flux Service registered with UsingRest has its own JsonSerializerOptions. Use ConfigureJsonSerializer to configure those options:

services.AddFlux(flux =>
{
    flux.AddService("example-api")
        .UsingRest("https://api.example.com")
        .ConfigureJsonSerializer((JsonSerializerOptions options) =>
        {
            // Configure the JsonSerializerOptions here
        });
});

The configuration applies to JSON request and response bodies for every Set belonging to the "example-api" Flux Service.

Tip

See the JsonSerializerOptions API reference for the available options.