'How can I correctly deserialize a Nested Array and/or Object Within a Nested Dictionary? (C# and Postman)

I'm building a restful api and I'm working through an issue where I have a user object that contains a dictionary that contains some user data, including a couple arrays, looks something like this:

{
  "userId": "12345e"
  "preferredStoreId": 54321
  "data": {
        "preferredMechanicId": 32415
        "garage":{
        "cars": [
                {
                "id": "1",
                "vinNumber": "GBH20391738N"
                },
                "id": "2",
                "vinNumber": "XHV21234738T"
                }
                ]
   }
}

Unfortunately, whenever I try to hit the associated api endpoint via postman I am getting "valueKind": 2 back instead of the array's contents, and similarly I am getting "valueKind": 1 for any custom objects in the data dictionary. I've tried setting breakpoints at multiple stages in the code and the data is always present right up to (and including) when I return the object within the actual getUser api endpoint.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source