Json 到 C# 模型问题 a class 总是 returns null

Json to C# models problem a class always returns null

这是我的 json 示例:

{
    "generated_at": "2020-11-24T11:27:57+00:00",
    "summaries": [
        {
            "sport_event": {
                "id": "sr:sport_event:22762631",
                "start_time": "2020-11-24T10:00:00+00:00",
                "start_time_confirmed": true,
                "sport_event_context": {
                    "sport": {
                        "id": "sr:sport:1",
                        "name": "Futbol"
                    },
                    "category": {
                        "id": "sr:category:393",
                        "name": "Uluslararas\u0131 Kul\u00fcpler"
                    },
                    "competition": {
                        "id": "sr:competition:463",
                        "name": "AFC \u015eampiyonlar Ligi"
                    },
                    "season": {
                        "id": "sr:season:74427",
                        "name": "AFC \u015eampiyonlar Ligi 2020",
                        "start_date": "2020-01-14",
                        "end_date": "2020-12-19",
                        "year": "2020",
                        "competition_id": "sr:competition:463"
                    },
                    "stage": {
                        "order": 3,
                        "type": "league",
                        "phase": "regular season",
                        "start_date": "2020-02-11",
                        "end_date": "2020-12-03",
                        "year": "2020"
                    },
                    "round": {
                        "number": 4
                    },
                    "groups": [
                        {
                            "id": "sr:league:49469",
                            "name": "AFC Champions League 2020, Group E",
                            "group_name": "E"
                        }
                    ]
                },
                "coverage": {
                    "type": "sport_event",
                    "sport_event_properties": {
                        "lineups": true,
                        "extended_player_stats": false,
                        "extended_team_stats": false,
                        "lineups_availability": "pre",
                        "ballspotting": true,
                        "commentary": true,
                        "fun_facts": true,
                        "goal_scorers": true,
                        "scores": "live",
                        "game_clock": true,
                        "deeper_play_by_play": true,
                        "deeper_player_stats": true,
                        "deeper_team_stats": true,
                        "basic_play_by_play": true,
                        "basic_player_stats": true,
                        "basic_team_stats": true
                    }
                },
                "competitors": [
                    {
                        "id": "sr:competitor:3376",
                        "name": "Beijing Guoan",
                        "country": "\u00c7in",
                        "country_code": "CHN",
                        "abbreviation": "BJG",
                        "qualifier": "home",
                        "gender": "male"
                    },
                    {
                        "id": "sr:competitor:5970",
                        "name": "Melbourne Victory FC",
                        "country": "Avustralya",
                        "country_code": "AUS",
                        "abbreviation": "MEV",
                        "qualifier": "away",
                        "gender": "male"
                    }
                ],
                "venue": {
                    "id": "sr:venue:54139",
                    "name": "Education City Stadium",
                    "capacity": 45350,
                    "city_name": "Al Rayyan",
                    "country_name": "Katar",
                    "map_coordinates": "25.310846, 51.424414",
                    "country_code": "QAT"
                },
                "sport_event_conditions": {
                    "referees": [
                        {
                            "id": "sr:referee:2101998",
                            "name": "Al-Abda, Saoud",
                            "type": "main_referee"
                        }
                    ],
                    "ground": {
                        "neutral": true
                    }
                }
            },
            "sport_event_status": {
                "status": "live",
                "match_status": "2nd_half",
                "home_score": 2,
                "away_score": 0,
                "period_scores": [
                    {
                        "home_score": 2,
                        "away_score": 0,
                        "type": "regular_period",
                        "number": 1
                    },
                    {
                        "home_score": 0,
                        "away_score": 0,
                        "type": "regular_period",
                        "number": 2
                    }
                ],
                "ball_locations": [
                    {
                        "order": 4,
                        "x": 24,
                        "y": 25,
                        "qualifier": "home"
                    },
                    {
                        "order": 3,
                        "x": 28,
                        "y": 54,
                        "qualifier": "home"
                    },
                    {
                        "order": 2,
                        "x": 31,
                        "y": 72,
                        "qualifier": "home"
                    },
                    {
                        "order": 1,
                        "x": 34,
                        "y": 75,
                        "qualifier": "home"
                    }
                ],
                "clock": {
                    "played": "70:17"
                }
            },
            "statistics": {
                "totals": {
                    "competitors": [
                        {
                            "id": "sr:competitor:3376",
                            "name": "Beijing Guoan",
                            "abbreviation": "BJG",
                            "qualifier": "home",
                            "statistics": {
                                "yellow_cards": 1,
                                "yellow_red_cards": 0,
                                "red_cards": 0,
                                "corner_kicks": 3,
                                "shots_total": 7,
                                "shots_on_target": 4,
                                "shots_off_target": 2,
                                "shots_blocked": 1,
                                "ball_possession": 65,
                                "free_kicks": 13,
                                "offsides": 1,
                                "goal_kicks": 4,
                                "throw_ins": 13,
                                "shots_saved": 0,
                                "fouls": 9,
                                "injuries": 1,
                                "cards_given": 1,
                                "substitutions": 3
                            },
                            "players": [
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:328303",
                                    "name": "Sen, Hou",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:1272814",
                                    "name": "Kim, Min-Jae",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:261597",
                                    "name": "Yang, Yu",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 1,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 1,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 1,
                                        "corner_kicks": 0,
                                        "shots_on_target": 1,
                                        "shots_off_target": 1,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:34152",
                                    "name": "Renato Augusto",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 1,
                                        "offsides": 0,
                                        "corner_kicks": 1,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:231992",
                                    "name": "Xizhe, Zhang",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:59872",
                                    "name": "Dabao, Yu",
                                    "starter": false
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:1418851",
                                    "name": "Fan, Yang",
                                    "starter": false
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:223230",
                                    "name": "Peng, Lu",
                                    "starter": false
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:328311",
                                    "name": "Tao, Jiang",
                                    "starter": false
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 1,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:815216",
                                    "name": "Dun, BA",
                                    "starter": false
                                }
                            ]
                        },
                        {
                            "id": "sr:competitor:5970",
                            "name": "Melbourne Victory FC",
                            "abbreviation": "MEV",
                            "qualifier": "away",
                            "statistics": {
                                "yellow_cards": 1,
                                "yellow_red_cards": 0,
                                "red_cards": 0,
                                "corner_kicks": 3,
                                "shots_total": 6,
                                "shots_on_target": 0,
                                "shots_off_target": 4,
                                "shots_blocked": 2,
                                "ball_possession": 35,
                                "free_kicks": 10,
                                "offsides": 3,
                                "goal_kicks": 7,
                                "throw_ins": 21,
                                "shots_saved": 2,
                                "fouls": 10,
                                "injuries": 0,
                                "cards_given": 1,
                                "substitutions": 4
                            },
                            "players": [
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 2,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:155973",
                                    "name": "Ansell, Nick",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 1,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:1436448",
                                    "name": "Kirdar, Birkan",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:122551",
                                    "name": "Traore, Adama",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 0,
                                        "offsides": 3,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:122374",
                                    "name": "Rojas, Marco",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 0,
                                        "substituted_out": 1,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:1270838",
                                    "name": "Folami, Ben",
                                    "starter": true
                                },
                                {
                                    "statistics": {
                                        "goals_scored": 0,
                                        "yellow_cards": 0,
                                        "yellow_red_cards": 0,
                                        "red_cards": 0,
                                        "own_goals": 0,
                                        "assists": 0,
                                        "substituted_in": 1,
                                        "substituted_out": 0,
                                        "offsides": 0,
                                        "corner_kicks": 0,
                                        "shots_on_target": 0,
                                        "shots_off_target": 0,
                                        "shots_blocked": 0
                                    },
                                    "id": "sr:player:1732609",
                                    "name": "Anderson, Aaron",
                                    "starter": false
                                }
                            ]
                        }
                    ]
                }
            }
        }

大家好, 我试图在在线转换的互联网站点上将 json 转换为 c# 模型,但我无法对球员或球队的统计数据做出反应。它 returns 始终为空。我如何生成这个 json 到 c# 模型正确到 c# 类?我无法获得任何球队或球员的统计数据。感谢你们对我的帮助 此致,

// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse); 
    public class Sport    {
        public string id { get; set; } 
        public string name { get; set; } 
    }

    public class Category    {
        public string id { get; set; } 
        public string name { get; set; } 
    }

    public class Competition    {
        public string id { get; set; } 
        public string name { get; set; } 
    }

    public class Season    {
        public string id { get; set; } 
        public string name { get; set; } 
        public string start_date { get; set; } 
        public string end_date { get; set; } 
        public string year { get; set; } 
        public string competition_id { get; set; } 
    }

    public class Stage    {
        public int order { get; set; } 
        public string type { get; set; } 
        public string phase { get; set; } 
        public string start_date { get; set; } 
        public string end_date { get; set; } 
        public string year { get; set; } 
    }

    public class Round    {
        public int number { get; set; } 
    }

    public class Group    {
        public string id { get; set; } 
        public string name { get; set; } 
        public string group_name { get; set; } 
    }

    public class SportEventContext    {
        public Sport sport { get; set; } 
        public Category category { get; set; } 
        public Competition competition { get; set; } 
        public Season season { get; set; } 
        public Stage stage { get; set; } 
        public Round round { get; set; } 
        public List<Group> groups { get; set; } 
    }

    public class SportEventProperties    {
        public bool lineups { get; set; } 
        public bool extended_player_stats { get; set; } 
        public bool extended_team_stats { get; set; } 
        public string lineups_availability { get; set; } 
        public bool ballspotting { get; set; } 
        public bool commentary { get; set; } 
        public bool fun_facts { get; set; } 
        public bool goal_scorers { get; set; } 
        public string scores { get; set; } 
        public bool game_clock { get; set; } 
        public bool deeper_play_by_play { get; set; } 
        public bool deeper_player_stats { get; set; } 
        public bool deeper_team_stats { get; set; } 
        public bool basic_play_by_play { get; set; } 
        public bool basic_player_stats { get; set; } 
        public bool basic_team_stats { get; set; } 
    }

    public class Coverage    {
        public string type { get; set; } 
        public SportEventProperties sport_event_properties { get; set; } 
    }

    public class Competitor    {
        public string id { get; set; } 
        public string name { get; set; } 
        public string country { get; set; } 
        public string country_code { get; set; } 
        public string abbreviation { get; set; } 
        public string qualifier { get; set; } 
        public string gender { get; set; } 
    }

    public class Venue    {
        public string id { get; set; } 
        public string name { get; set; } 
        public int capacity { get; set; } 
        public string city_name { get; set; } 
        public string country_name { get; set; } 
        public string map_coordinates { get; set; } 
        public string country_code { get; set; } 
    }

    public class Referee    {
        public string id { get; set; } 
        public string name { get; set; } 
        public string type { get; set; } 
    }

    public class Ground    {
        public bool neutral { get; set; } 
    }

    public class SportEventConditions    {
        public List<Referee> referees { get; set; } 
        public Ground ground { get; set; } 
    }

    public class SportEvent    {
        public string id { get; set; } 
        public DateTime start_time { get; set; } 
        public bool start_time_confirmed { get; set; } 
        public SportEventContext sport_event_context { get; set; } 
        public Coverage coverage { get; set; } 
        public List<Competitor> competitors { get; set; } 
        public Venue venue { get; set; } 
        public SportEventConditions sport_event_conditions { get; set; } 
    }

    public class PeriodScore    {
        public int home_score { get; set; } 
        public int away_score { get; set; } 
        public string type { get; set; } 
        public int number { get; set; } 
    }

    public class BallLocation    {
        public int order { get; set; } 
        public int x { get; set; } 
        public int y { get; set; } 
        public string qualifier { get; set; } 
    }

    public class Clock    {
        public string played { get; set; } 
    }

    public class SportEventStatus    {
        public string status { get; set; } 
        public string match_status { get; set; } 
        public int home_score { get; set; } 
        public int away_score { get; set; } 
        public List<PeriodScore> period_scores { get; set; } 
        public List<BallLocation> ball_locations { get; set; } 
        public Clock clock { get; set; } 
    }

    public class Statistics2    {
        public int yellow_cards { get; set; } 
        public int yellow_red_cards { get; set; } 
        public int red_cards { get; set; } 
        public int corner_kicks { get; set; } 
        public int shots_total { get; set; } 
        public int shots_on_target { get; set; } 
        public int shots_off_target { get; set; } 
        public int shots_blocked { get; set; } 
        public int ball_possession { get; set; } 
        public int free_kicks { get; set; } 
        public int offsides { get; set; } 
        public int goal_kicks { get; set; } 
        public int throw_ins { get; set; } 
        public int shots_saved { get; set; } 
        public int fouls { get; set; } 
        public int injuries { get; set; } 
        public int cards_given { get; set; } 
        public int substitutions { get; set; } 
    }

    public class Statistics3    {
        public int goals_scored { get; set; } 
        public int yellow_cards { get; set; } 
        public int yellow_red_cards { get; set; } 
        public int red_cards { get; set; } 
        public int own_goals { get; set; } 
        public int assists { get; set; } 
        public int substituted_in { get; set; } 
        public int substituted_out { get; set; } 
        public int offsides { get; set; } 
        public int corner_kicks { get; set; } 
        public int shots_on_target { get; set; } 
        public int shots_off_target { get; set; } 
        public int shots_blocked { get; set; } 
    }

    public class Player    {
        public Statistics3 statistics { get; set; } 
        public string id { get; set; } 
        public string name { get; set; } 
        public bool starter { get; set; } 
    }

    public class Competitor2    {
        public string id { get; set; } 
        public string name { get; set; } 
        public string abbreviation { get; set; } 
        public string qualifier { get; set; } 
        public Statistics2 statistics { get; set; } 
        public List<Player> players { get; set; } 
    }

    public class Totals    {
        public List<Competitor2> competitors { get; set; } 
    }

    public class Statistics    {
        public Totals totals { get; set; } 
    }

    public class Summary    {
        public SportEvent sport_event { get; set; } 
        public SportEventStatus sport_event_status { get; set; } 
        public Statistics statistics { get; set; } 
    }

    public class Root    {
        public DateTime generated_at { get; set; } 
        public List<Summary> summaries { get; set; } 
    }

此资源可以提供帮助:https://json2csharp.com/

我已经尝试使用 json2csharp 将您的 json 转换为 c# 模型,并且能够毫无问题地反序列化

var myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);

模型如下所示

public class Sport    {
    public string id { get; set; } 
    public string name { get; set; } 
}

public class Category    {
    public string id { get; set; } 
    public string name { get; set; } 
}

public class Competition    {
    public string id { get; set; } 
    public string name { get; set; } 
}

public class Season    {
    public string id { get; set; } 
    public string name { get; set; } 
    public string start_date { get; set; } 
    public string end_date { get; set; } 
    public string year { get; set; } 
    public string competition_id { get; set; } 
}

public class Stage    {
    public int order { get; set; } 
    public string type { get; set; } 
    public string phase { get; set; } 
    public string start_date { get; set; } 
    public string end_date { get; set; } 
    public string year { get; set; } 
}

public class Round    {
    public int number { get; set; } 
}

public class Group    {
    public string id { get; set; } 
    public string name { get; set; } 
    public string group_name { get; set; } 
}

public class SportEventContext    {
    public Sport sport { get; set; } 
    public Category category { get; set; } 
    public Competition competition { get; set; } 
    public Season season { get; set; } 
    public Stage stage { get; set; } 
    public Round round { get; set; } 
    public List<Group> groups { get; set; } 
}

public class SportEventProperties    {
    public bool lineups { get; set; } 
    public bool extended_player_stats { get; set; } 
    public bool extended_team_stats { get; set; } 
    public string lineups_availability { get; set; } 
    public bool ballspotting { get; set; } 
    public bool commentary { get; set; } 
    public bool fun_facts { get; set; } 
    public bool goal_scorers { get; set; } 
    public string scores { get; set; } 
    public bool game_clock { get; set; } 
    public bool deeper_play_by_play { get; set; } 
    public bool deeper_player_stats { get; set; } 
    public bool deeper_team_stats { get; set; } 
    public bool basic_play_by_play { get; set; } 
    public bool basic_player_stats { get; set; } 
    public bool basic_team_stats { get; set; } 
}

public class Coverage    {
    public string type { get; set; } 
    public SportEventProperties sport_event_properties { get; set; } 
}

public class Competitor    {
    public string id { get; set; } 
    public string name { get; set; } 
    public string country { get; set; } 
    public string country_code { get; set; } 
    public string abbreviation { get; set; } 
    public string qualifier { get; set; } 
    public string gender { get; set; } 
}

public class Venue    {
    public string id { get; set; } 
    public string name { get; set; } 
    public int capacity { get; set; } 
    public string city_name { get; set; } 
    public string country_name { get; set; } 
    public string map_coordinates { get; set; } 
    public string country_code { get; set; } 
}

public class Referee    {
    public string id { get; set; } 
    public string name { get; set; } 
    public string type { get; set; } 
}

public class Ground    {
    public bool neutral { get; set; } 
}

public class SportEventConditions    {
    public List<Referee> referees { get; set; } 
    public Ground ground { get; set; } 
}

public class SportEvent    {
    public string id { get; set; } 
    public DateTime start_time { get; set; } 
    public bool start_time_confirmed { get; set; } 
    public SportEventContext sport_event_context { get; set; } 
    public Coverage coverage { get; set; } 
    public List<Competitor> competitors { get; set; } 
    public Venue venue { get; set; } 
    public SportEventConditions sport_event_conditions { get; set; } 
}

public class PeriodScore    {
    public int home_score { get; set; } 
    public int away_score { get; set; } 
    public string type { get; set; } 
    public int number { get; set; } 
}

public class BallLocation    {
    public int order { get; set; } 
    public int x { get; set; } 
    public int y { get; set; } 
    public string qualifier { get; set; } 
}

public class Clock    {
    public string played { get; set; } 
}

public class SportEventStatus    {
    public string status { get; set; } 
    public string match_status { get; set; } 
    public int home_score { get; set; } 
    public int away_score { get; set; } 
    public List<PeriodScore> period_scores { get; set; } 
    public List<BallLocation> ball_locations { get; set; } 
    public Clock clock { get; set; } 
}

public class Statistics2    {
    public int yellow_cards { get; set; } 
    public int yellow_red_cards { get; set; } 
    public int red_cards { get; set; } 
    public int corner_kicks { get; set; } 
    public int shots_total { get; set; } 
    public int shots_on_target { get; set; } 
    public int shots_off_target { get; set; } 
    public int shots_blocked { get; set; } 
    public int ball_possession { get; set; } 
    public int free_kicks { get; set; } 
    public int offsides { get; set; } 
    public int goal_kicks { get; set; } 
    public int throw_ins { get; set; } 
    public int shots_saved { get; set; } 
    public int fouls { get; set; } 
    public int injuries { get; set; } 
    public int cards_given { get; set; } 
    public int substitutions { get; set; } 
}

public class Statistics3    {
    public int goals_scored { get; set; } 
    public int yellow_cards { get; set; } 
    public int yellow_red_cards { get; set; } 
    public int red_cards { get; set; } 
    public int own_goals { get; set; } 
    public int assists { get; set; } 
    public int substituted_in { get; set; } 
    public int substituted_out { get; set; } 
    public int offsides { get; set; } 
    public int corner_kicks { get; set; } 
    public int shots_on_target { get; set; } 
    public int shots_off_target { get; set; } 
    public int shots_blocked { get; set; } 
}

public class Player    {
    public Statistics3 statistics { get; set; } 
    public string id { get; set; } 
    public string name { get; set; } 
    public bool starter { get; set; } 
}

public class Competitor2    {
    public string id { get; set; } 
    public string name { get; set; } 
    public string abbreviation { get; set; } 
    public string qualifier { get; set; } 
    public Statistics2 statistics { get; set; } 
    public List<Player> players { get; set; } 
}

public class Totals    {
    public List<Competitor2> competitors { get; set; } 
}

public class Statistics    {
    public Totals totals { get; set; } 
}

public class Summary    {
    public SportEvent sport_event { get; set; } 
    public SportEventStatus sport_event_status { get; set; } 
    public Statistics statistics { get; set; } 
}

public class Root    {
    public DateTime generated_at { get; set; } 
    public List<Summary> summaries { get; set; } 
}

有 3 个 statistics 具有不同属性。 虽然对您来说,它是同一个实体是合乎逻辑的。为什么一个工具会假设它是相同的。

根据您查看这些统计信息的方式,您有 2 个解决方案。它是具有有限属性集的 class 吗? 然后您将所有这些属性都放在同一个 class 中并消除重复项。

或者 Statistic 是一组疯狂的未绑定的名称和值。你不知道下一个统计数据是什么“蓝眼玩家数量”

[JsonProperty("statistics")]   public Dictionary<string, long> Statistics { get; set; }