我从REST API获取下面的JSON响应。无法反序列化C中的JSON#
{
"data":{
"id":123,
"zoneid":"mydomain.com",
"parent_id":null,
"name":"jaz",
"content":"172.1 6.15.235",
"ttl":60,
"priority":null,
"type":"A",
"regions":[
"global"
],
"system_record":false,
"created_at":"2017-09-28T12:12:17Z",
"updated_at":"2017-09-28T12:12:17Z"
}
}
并试图解决使用下面的代码,但不会导致正确的反序列化类型。
var model = JsonConvert.DeserializeObject<ResponseModel>(response);
下面是根据我在JSON响应中收到的字段的类。
public class ResponseModel
{
public int id { get; set; }
public string zone_id { get; set; }
public int parent_id { get; set; }
public string name { get; set; }
public string content { get; set; }
public int ttl { get; set; }
public int priority { get; set; }
public string type { get; set; }
public string[] regions { get; set; }
public bool system_record { get; set; }
public DateTime created_at { get; set; }
public DateTime updated_at { get; set; }
}
缺少什么?
很好的把戏。和json2csharp一样,但在IDE中。谢谢 – OrcusZ