I am looking to convert the following data into a c# object or array in which i can display each item (eventually to be displayed in a list view).
the json itself looks like this:
[
{
"commonName": "uni_comp_4",
"processorID": "BFEFBDEB001201"
},
{
"commonName": "lib_comp_12",
"processorID": "BFEFBDEB004323"
}
]
I have looked here for help however I think I may have to take another approach as my system is slightly different.
I'm using a class:
public class API_Response
{
public bool IsError { get; set; }
public string ErrorMessage { get; set;
public dynamic ResponseData { get; set; }
}
for data carrying. My JSON "data" is as shown above however I have been having issues deserialising this.
Initially, I tried:
API_Response r = JsonConvert.DeserializeObject<API_Response>(response);
and I'm able to see the JSON string with MessageBox.show(r.ResponseData). Which inherently is not deserialised.
Additionally, I have tried declaring the following in the same method:
public class RootObject
{
public string commonName { get; set; }
public string processorID { get; set; }
}
with no luck in displaying this data individually (or at all).
Essentially, I'm trying to put class API_Response's "ResponseData" into an object and I'm having difficulty.
>(response);
– Sir Rufo Nov 19 '18 at 01:43