❔ Troubleshooting JSON Mapping for POST Request to UserAsync Endpoint
I'm seeking guidance on formatting the JSON body for a POST request to the following API endpoint:
API Signature:
csharp
JSON Body (inputData):
The issue I'm encountering is that "userName": "AM" is being incorrectly mapped to HikariUser projectUser.Username, when it should be filling the *exampleProjectUser *field. Additionally, the other properties of HikariUser are not being correctly populated and are showing as null.
I've already tried using [JsonPropertyName("")] attributes without success. Any guidance or solutions to ensure the correct mapping of JSON properties to the method parameters would be greatly appreciated.
3 Replies
The solution for this that i made was the following
Changed the signature to following
And then i filled the string param wiht string query.
Yeah you need to tell the modelsbinder where to get the data from. If you want to get everything from the body, make a record that has a user and a username
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.