cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
krubin
Level 7

Deserialization Issu

Hi,

I am receiving a successful response both in Postman and using C# from Visual Studio, when polling for update information.  However I can't seem to de-serialize the  result from the "get " in C#.

The response is shown below. The associated classes were generated by the site https://json2csharp.com/ based on the response below from Postman. I made the classes Public.

In C# I use:

string uri = "uai/2.0/updates/" + retString;
//retString value comes from the response of the Post for updates.

response = client.GetAsync(uri).Result;
var value = JsonConvert.DeserializeObject<MyRoot>(                        
response.Content.ReadAsStringAsync().Result);
The result is 202-ok, however the response in the structure is nulls. Do you know why?
 
Thank you,
Ken
 
Flexera Response
{
    "updateItems": [
        {
            "commandLine""",
            "description""We speak English!",
            "expireDate""10/04/2029",
            "fromPackageId""Revenera 2020 Base Test",
            "updateId""ReveneraTest",
            "languageCode"1033,
            "updateName""ReveneraTest",
            "productName""",
            "startDate""09/01/2020",
            "title""English",
            "toPackageId""Revenera 2020 test",
            "manifestUUID""424e21ee-ee83-4580-9819-bfa52d4d547e"
        }
    ],
    "error": {
        "key""",
        "message""",
        "arguments"""
    }
}
namespace Revenera2
{
    public class MyRoot
    {
        public List<UpdateItem> updateItems { getset; }
        public Error error { getset; }
    }
}
namespace Revenera2
{
    public class Error
    {
        public string key { getset; }
        public string message { getset; }
        public string arguments { getset; }
    }
}
namespace Revenera2
{
    public class UpdateItem
    {
        public string commandLine { getset; }
        public string description { getset; }
        public string expireDate { getset; }
        public string fromPackageId { getset; }
        public string updateId { getset; }
        public int languageCode { getset; }
        public string updateName { getset; }
        public string productName { getset; }
        public string startDate { getset; }
        public string title { getset; }
        public string toPackageId { getset; }
        public string manifestUUID { getset; }
    }
}
 

 

0 Kudos
(1) Reply
krubin
Level 7

I figured this one out sorry!