.NET Get Users JSON Serialization Error
When using the .NET SDK, I'm trying to use an M2M flow to get user information. The M2M application has the get:users scope for the Management API and I've set up a simple .NET test app to retrieve and print users based on the .NET SDK documentation (https://docs.kinde.com/developer-tools/sdks/backend/dotnet-sdk/#configure-api-client) but it looks like there is a JSON serialization error for the response coming back. Am I doing something wrong in setting up this call to Management API?
Exception has occurred: CLR/Kinde.Api.Client.ApiException
An exception of type 'Kinde.Api.Client.ApiException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Kinde.Api.Client.Option
1[System.Collections.Generic.List1[Kinde.Api.Model.UsersResponseUsersInner]]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
Path 'users', line 1, position 25.'
at Kinde.Api.Client.CustomJsonCodec.<Deserialize>d7.MoveNext()
at Kinde.Api.Client.CustomJsonCodec.<Deserialize>d61.MoveNext()
at Kinde.Api.Client.ApiClient.<ExecAsync>d__221.MoveNext()
at Kinde.Api.Api.UsersApi.<GetUsersWithHttpInfoAsync>d65.MoveNext()
at Kinde.Api.Api.UsersApi.<GetUsersAsync>d64.MoveNext()
at Program.<<Main>$>d__0.MoveNext() in c:\repos\chill-warrior\kinde-test\Program.cs:line 17Kinde docs
.NET SDK
Guide to using the Kinde .NET SDK for integrating with the Management API, including installation, configuration, and API calls for user and organization management.

6 Replies
Thanks for sharing the details @Joel. To better understand what’s happening, could you please share the file where you’re making the call to the Management API? That way I can take a closer look. If you’re more comfortable, you can also share it with us directly via support@kinde.com. Feel free to remove or redact any sensitive information before sharing.
Here's the file. It's a pretty simple .NET console app.
Thanks for sharing the file, @Joel. I’ll take a closer look and get back to you shortly.
Thanks again for sharing the file, @Joel. I’ll need to check in with one of our experts on this. Since we’re heading into the weekend, you can expect to hear back from us on Monday.
This looks like it's a bug that's already been reported by another user. See https://discord.com/channels/1070212618549219328/1416588534101577728
I would suggest that the newer versions of the .NET SDK are unusable until it gets resolved.
Joel, I suspect if you downgrade your Nuget package down to the version tested by the bug reporter it will fix your issue until a proper fix is introduced.
Thanks both for flagging this and for linking to the Discord thread. A fix has already been raised in the latest PR and is currently under review. Once it’s merged and released, we’ll let you know. Really appreciate your patience in the meantime.
GitHub
Refactor/json serialization fixes by brettchaldecott · Pull Reques...
Explain your changes
This branch focuses on enhancing JSON serialization and deserialization throughout the Kinde .NET SDK, addressing compatibility issues and improving reliability across differen...
Just a quick update, .NET SDK v2.0.2 is now live on nuget and includes the fix for the JSON deserialization issue. GitHub release notes will be published shortly. Let us know if you spot anything else.