The following bit of code attempts to read some json and populate an object:
public Response ParseObject(string Json)
{
Response response = new Response();
JsonConvert.PopulateObject(Json, response);
return response;
}
Here's the Response object:
public class Response
{
public string id { get; set; }
public string name { get; set; }
public string description { get; set; }
public string status { get; set; }
public string incorporationDate { get; set; }
public string latestAnnualReturnDate { get; set; }
public string latestAccountsDate { get; set; }
public string companyType { get; set; }
public string accountsType { get; set; }
Unfortunately, the object (response) is empty ie (response.id is null as are all of the other properties).
I'm guessing that I need to pass in some JsonSerializerSettings but I can't find a tutorial anywhere?