json  转类

json  转类

json 转类

{
"animals":

{
"dog":

[
{"name":"Rufus", "breed":"labrador", "count":1, "twoFeet":false},
{"name":"Marty", "breed":"whippet", "count":1, "twoFeet":false}
],

"cat":{"name":"Matilda"}
}
}

public class DogItem
{   
    public string name { get; set; }
 
    public string breed { get; set; }

    public int count { get; set; }

    public string twoFeet { get; set; }
}

public class Cat
{
    public string name { get; set; }
}

public class Animals
{
    public List <DogItem > dog { get; set; }

    public Cat cat { get; set; }
}

public class Root
{
    public Animals animals { get; set; }
}