Hi Team,
My Json is looks like below,
{"StatusCode":"0","Message":"Success","Response":"[{\"CatRoot\":{\"CategoryId\":69,\"CategoryName\":\"FOOD\",\"BrandId\":null,\"BrandName\":null},{\"CatRoot\":{\"CategoryId\":69,\"CategoryName\":\"FOOD\",\"BrandId\":null,\"BrandName\":null}}}]}
And I am trying to deserialize, But I am getting an error
"could not cast or convert from system.string to myObject"
public class CategoryResponse
{
public CategoryTree Response { get; set; }
public string StatusCode { get; set; }
public string Message { get; set; }
}
public class CategoryTree
{
public List<CategoryAPI> CatRoot { get; set; }
}
public class APISubCategory
{
public string CategoryId { get; set; }
public string CategoryName { get; set; }
public Brand brand { get; set; }
public int? ParentAutoID { get; set; }
}
var productResult = JsonConvert.DeserializeObject<CategoryResponse>(response);
So In above line I am getting error, Any help would be appreciated.
Thanks in Advance.