-3
{
"success":true,
"cityList":[
{
"id":3793,
"name":"New York",
"country":"USA",
"district":"New York",
"population":8008278,
"lastYearPopulation":6807036
},
{
"id":3794,
"name":"Los Angeles",
"country":"USA",
"district":"California",
"population":3694820,
"lastYearPopulation":3140597
},
{
"id":3795,
"name":"Chicago",
"country":"USA",
"district":"Illinois",
"population":2896016,
"lastYearPopulation":2461613
},
{
"id":3796,
"name":"Houston",
"country":"USA",
"district":"Texas",
"population":1953631,
"lastYearPopulation":1660586
},
{
"id":3797,
"name":"Philadelphia",
"country":"USA",
"district":"Pennsylvania",
"population":1517550,
"lastYearPopulation":1289917
},
{
"id":3798,
"name":"Phoenix",
"country":"USA",
"district":"Arizona",
"population":1321045,
"lastYearPopulation":1122888
},
{
"id":3799,
"name":"San Diego",
"country":"USA",
"district":"California",
"population":1223400,
"lastYearPopulation":1039890
},
{
"id":3800,
"name":"Dallas",
"country":"USA",
"district":"Texas",
"population":1188580,
"lastYearPopulation":1010293
},
{
"id":3801,
"name":"San Antonio",
"country":"USA",
"district":"Texas",
"population":1144646,
"lastYearPopulation":972949
},
{
"id":3802,
"name":"Detroit",
"country":"USA",
"district":"Michigan",
"population":951270,
"lastYearPopulation":808579
}],
"totalCount":100
}
4

1 回答 1

0

使用Json2csharp并找出你的 json 的类。应该有帮助。这是你的课程:

public class CityList
{
    public int id { get; set; }
    public string name { get; set; }
    public string country { get; set; }
    public string district { get; set; }
    public int population { get; set; }
    public int lastYearPopulation { get; set; }
}

public class RootObject
{
    public bool success { get; set; }
    public List<CityList> cityList { get; set; }
    public int totalCount { get; set; }
}
于 2013-11-08T10:12:49.187 回答