Skip to content
Discussion options

You must be logged in to vote

A null inner property after a successful (no-error) deserialize almost always means a name mismatch between the JSON and your model, not a Refit bug.

In your payload the shape is:

{ "error": null, "data": { "agentList": [ ... ] } }

By default Refit uses System.Text.Json, which is case-sensitive and does not map snake_case automatically. So a property named Data will not bind to "data" unless you configure it.

Fixes (pick one):

  • Make matching case-insensitive (and snake_case if needed) by passing JsonSerializerOptions when you build the client:
var options = new JsonSerializerOptions
{
    PropertyNameCaseInsensitive = true,
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase
};

var api =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by glennawatson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants