I am consuming an API response and the response contains a list of items. Here is example JSON
{
"attendeeid": "1",
"responses": {
"1": {
"questionid": "1",
"fieldname": "1",
"name": "question?",
"pageid": "2",
"page": "Attendee Information",
"auto_capitalize": "0",
"choicekey": "",
"response": [
" Identify need",
" Evaluate products and services"
]
},
"2": {
"questionid": "2",
"fieldname": "2",
"name": "question2",
"pageid": "2",
"page": "Attendee Information",
"auto_capitalize": "0",
"choicekey": "live",
"response": "live"
},
},
}
As you can see, the response field in the response can be an object, or a string.
How can I create a POCO object which can be deserialized into? Currently my class is
public class RegistrantInfoResponse
{
public string questionid { get; set; }
public string fieldname { get; set; }
public string name { get; set; }
public string response { get; set; }
}
public class RegistrantInfo
{
public string attendeeid { get; set; }
public List<RegistrantInfoResponse> responses { get; set; }
}