EDIT: turns out I can deserialize just fine, the problem is actually when I try to loop through to grab the questions. Same error though "Object reference not set to an instance of an object". I am only editing this because I can't delete the post now that it has answers.
//deserialize json
ResponsesList responses = JsonConvert.DeserializeObject<ResponsesList>(_ResponseContent);
if (responses != null)
{
//loop through responses
foreach (ResponsesList.Data data in responses.data)
foreach (ResponsesList.Questions question in data.questions)
foreach (ResponsesList.Answer answer in question.answers)
{
//upsert each response
UpsertResponse(survey_id, data.respondent_id, question.question_id, answer.row, answer.col);
}
}
This line is where the error occurs
foreach (ResponsesList.Questions question in data.questions)
Here is the class I am deserializing to
//get_responses
public class ResponsesList
{
public int status { get; set; }
public List<Data> data { get; set; }
public class Data
{
public string respondent_id { get; set; }
public List<Questions> questions { get; set; }
}
public class Questions
{
public List<Answer> answers { get; set; }
public string question_id { get; set; }
}
public class Answer
{
public string row { get; set; }
public string col { get; set; }
}
}