我得到以下 JSON,我试图使用 RestSharp 将其转换为业务对象
{
"valid":true,
"data":[
{
"dealerId":"4373",
"branchId":"4373",
}
]
}
我希望转换为:
public class Dealer
{
public string dealerId ;
public string branchId;
}
但这失败了,尽管 JSON 很好:
var client = new RestClient("http://www.????.com.au");
var request = new RestRequest(string.Format("service/autocomplete/dealer/{0}/{1}.json", suburb.PostCode, suburb.City.Trim().Replace(" ", "%20")), Method.GET);
var response2 = client.Execute<Dealer>(request);
return response2.Data;