I am trying to Deserialize a json string into a class, however, the property keeps coming up null.
IRestResponse companyResponse = companyClient.Execute(companyRequest);
Company companyList = JsonConvert.DeserializeObject<Company>(companyResponse.Content);
public class Company
{
public string id { get; set; }
}
The company get request pulls in several other pieces of data, but I am only interested in the ID value. From what I have read on this site as well as on the internet, the above should work.
EDIT: The returning get
"{\"companies\":[{\"id\":\"7f91f557-4d12-486e-ba89-09c46c8a56b7\",\"name\":\"storEDGE Demo\",\"contact_email\":\"\",\"contact_phone\":\"5555555555\",\"rental_center_subdomain\":null,\"websites\":[{\"provider\":\"storedge\",\"provider_id\":\"storedgedemo\"}],\"eligible_for_voyager_website\":[{\"provider_exists\":true,\"api_association_exists\":true}],\"sales_demo\":true,\"pusher_channel\":\"private-company-7f91f5574d12486eba8909c46c8a56b7\",\"address\":{\"id\":\"b4afccb5-4d5d-4ccd-9965-67280cb868c5\",\"address1\":\"1234 storEDGE St. \",\"address2\":\"\",\"city\":\"Kansas City\",\"state\":\"MO\",\"postal\":\"66205\",\"country\":\"US\",\"full_address\":\"1234 storEDGE St. , Kansas City, MO 66205\",\"latitude\":null,\"longitude\":null,\"time_zone_id\":\"America/Chicago\",\"time_zone_offset\":\"-05:00\",\"invalid_data\":false,\"label\":\"Home\"}},{\"id\":\"249f62c7-64fb-4e12-ac91-9a4a30c1ab1c\",\"name\":\"SafeStor Insurance Company\",\"contact_email\":\"[email protected]\",\"contact_phone\":\"\",\"rental_center_subdomain\":null,\"websites\":[],\"eligible_for_voyager_website\":[{\"provider_exists\":false,\"api_association_exists\":false}],\"sales_demo\":false,\"pusher_channel\":\"private-company-249f62c764fb4e12ac919a4a30c1ab1c\",\"address\":{\"id\":\"aa5a7775-1eb9-4fc6-8b91-b2179b9fd1fb\",\"address1\":\"5901 Catalina\",\"address2\":\"\",\"city\":\"Fairway\",\"state\":\"KS\",\"postal\":\"66205\",\"country\":\"US\",\"full_address\":\"5901 Catalina, Fairway, KS 66205\",\"latitude\":null,\"longitude\":null,\"time_zone_id\":\"America/Chicago\",\"time_zone_offset\":\"-05:00\",\"invalid_data\":false,\"label\":\"Home\"}}],\"meta\":{\"pagination\":{\"current_page\":1,\"total_pages\":1,\"per_page\":100,\"total_entries\":2,\"previous_page\":null,\"next_page\":null},