I am trying to Parse JSON from a url and store it in dataset.
public override void getJobsFromSource()
{
string url = @"https://data.usajobs.gov/api/jobs?Country=United%20States&NumberOfJobs=1&Page=1";
DataTable dt = new DataTable();
DataSet data = JsonConvert.DeserializeObject<DataSet>(url);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
}
But I get this exception:{"Unexpected character encountered while parsing value: h. Path '', line 0, position 0."} I tried it a different way:
public override void getJobsFromSource()
{
string url = @"https://data.usajobs.gov/api/jobs?Country=United%20States&NumberOfJobs=1&Page=1";
DataTable dt = (DataTable)JsonConvert.DeserializeObject(url, (typeof(DataTable)));
DataSet ds = new DataSet();
ds.Tables.Add(dt);
}
And i got the same exception.What am i doing wrong?Thanks