Whenever I run this program the JSON visualizer shows that all of the JSON is being read from the url, however it keeps saying that additional text is found after deserializing object.
My main goal is just to be able to read the JSON and add it to a Dataset of some sort so that I can display it
public class Wrapper
{
[JsonProperty("results")]
public DataSet DataSet { get; set; }
}
public class Rootobject
{
public int response_code { get; set; }
public Result[] results { get; set; }
}
public class Result
{
public string category { get; set; }
public string type { get; set; }
public string difficulty { get; set; }
public string question { get; set; }
public string correct_answer { get; set; }
public string[] incorrect_answers { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
string json = (new WebClient()).DownloadString("https://opentdb.com/api.php?amount=10&type=boolean");
DataSet ds = JsonConvert.DeserializeObject<Wrapper>(json).DataSet;
}
}
}
}