其中一种回应是:
{
"Stages": [
{
"Sid": "13182",
"Snm": "Women's Premier League",
"Scd": "womens-premier-league",
"Cnm": "India",
"Csnm": "India",
"Ccd": "india",
"Scu": 0,
"Events": [
{
"Eid": "902264",
"Pids": {
"8": "902264",
"12": "SBTE_28574291"
},
"Media": {
"12": [
{
"eventId": "Sky Sports",
"provider": "ABELSON",
"type": "TV_CHANNEL",
"allowedCountries": [
"GB",
"IE"
]
}
]
},
"T1": [
{
"Nm": "UP Warriorz",
"ID": "248138",
"Abr": "UPW"
}
],
"T2": [
{
"Nm": "Royal Challengers Bangalore Women",
"ID": "248140",
"Abr": "ROY"
}
],
"Eps": "NS",
"Esid": 1,
"EpsL": "Not started",
"Epr": 0,
"Ecov": 0,
"ErnInf": "Match 13",
"Et": 100,
"EtTx": "Womens Domestic Twenty20",
"ECo": "Teams will be announced at the toss",
"TPa": 0,
"TCho": 0,
"Esd": 20230315193000,
"Ese": 20230315193000,
"Exd": 1,
"EO": 524295,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "39",
"Snm": "World Cup League 2",
"Scd": "world-cup-league-2",
"Cnm": "ICC Men's One-Day World Cup",
"Csnm": "ICC Men's One-Day World Cup",
"Ccd": "icc-mens-one-day-world-cup",
"Scu": 1,
"Events": [
{
"Eid": "894448",
"Pids": {
"8": "894448",
"12": "SBTE_28574320"
},
"Media": {
"12": [
{
"eventId": "368052",
"provider": "IMG",
"type": "LIVE_STREAMING",
"allowedCountries": [
"GB",
"IE",
"NL"
]
}
]
},
"Tr1C1": 234,
"Tr2C1": 236,
"Tr1CW1": 7,
"Tr2CW1": 4,
"Tr1CO1": 50.0,
"Tr2CO1": 38.4,
"T1": [
{
"Nm": "Papua New Guinea",
"ID": "86152",
"Abr": "PAP"
}
],
"T2": [
{
"Nm": "United Arab Emirates",
"ID": "86127",
"Abr": "UNI"
}
],
"Eps": "FT",
"Esid": 6,
"EpsL": "Finished",
"Epr": 2,
"Ecov": 0,
"ErnInf": "Match 128",
"Et": 120,
"EtTx": "ODI",
"ECo": "United Arab Emirates win by 6 wickets",
"TPa": 1,
"TCho": 1,
"Esd": 20230315084500,
"Ese": 20230315084500,
"Exd": 1,
"EO": 6291557,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "12979",
"Snm": "Pakistan Super League",
"Scd": "super-league",
"Cnm": "Pakistan",
"Csnm": "Pakistan",
"Ccd": "pakistan",
"Scu": 0,
"Events": [
{
"Eid": "916122",
"Pids": {
"8": "916122",
"12": "SBTE_28567598"
},
"Media": {
"12": [
{
"eventId": "Sky Sports",
"provider": "ABELSON",
"type": "TV_CHANNEL",
"allowedCountries": [
"GB",
"IE"
]
}
]
},
"T1": [
{
"Nm": "Lahore Qalandars",
"ID": "86143",
"Abr": "LAH"
}
],
"T2": [
{
"Nm": "Multan Sultans",
"ID": "86139",
"Abr": "MUL"
}
],
"Eps": "NS",
"Esid": 1,
"EpsL": "Not started",
"Epr": 0,
"Ecov": 0,
"ErnInf": "Qualifier",
"Et": 100,
"EtTx": "Domestic Twenty20",
"ECo": "Teams will be announced at the toss",
"TPa": 0,
"TCho": 0,
"Esd": 20230315193000,
"Ese": 20230315193000,
"Exd": 1,
"EO": 524295,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "10935",
"Snm": "Marsh Sheffield Shield",
"Scd": "marsh-sheffield-shield",
"Cnm": "Australia",
"Csnm": "Australia",
"Ccd": "australia",
"Scu": 0,
"Events": [
{
"Eid": "723835",
"Pids": {
"8": "723835",
"12": "SBTE_28555865"
},
"Tr1C1": 479,
"Tr2C1": 180,
"Tr1CW1": 7,
"Tr2CW1": 6,
"Tr1CD1": 1,
"Tr1CO1": 140.0,
"Tr2CO1": 50.0,
"T1": [
{
"Nm": "Tasmania",
"ID": "86292",
"Abr": "TAS"
}
],
"T2": [
{
"Nm": "Queensland",
"ID": "86295",
"Abr": "QUE"
}
],
"Eps": "",
"Esid": 133,
"EpsL": "Stumps - day 2",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Queensland trail Tasmania by 299 runs with 4 wickets remaining",
"Ebat": 2,
"TPa": 2,
"TCho": 2,
"Esd": 20230314050000,
"Ese": 20230317050000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
},
{
"Eid": "723836",
"Pids": {
"8": "723836",
"12": "SBTE_28555866"
},
"Tr1C1": 134,
"Tr2C1": 447,
"Tr1CW1": 3,
"Tr2CW1": 9,
"Tr2CD1": 1,
"Tr1CO1": 54.0,
"Tr2CO1": 133.4,
"T1": [
{
"Nm": "South Australia",
"ID": "86297",
"Abr": "SOU"
}
],
"T2": [
{
"Nm": "New South Wales",
"ID": "86293",
"Abr": "NEW"
}
],
"Eps": "",
"Esid": 133,
"EpsL": "Stumps - day 2",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "South Australia trail New South Wales by 313 runs with 7 wickets remaining",
"Ebat": 1,
"TPa": 1,
"TCho": 2,
"Esd": 20230314053000,
"Ese": 20230317053000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
},
{
"Eid": "723829",
"Pids": {
"8": "723829",
"12": "SBTE_28555867"
},
"Tr1C1": 122,
"Tr2C1": 298,
"Tr1C2": 88,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 3,
"Tr1CO1": 61.0,
"Tr2CO1": 92.0,
"Tr1CO2": 28.0,
"T1": [
{
"Nm": "Western Australia",
"ID": "86294",
"Abr": "WES"
}
],
"T2": [
{
"Nm": "Victoria",
"ID": "86296",
"Abr": "VIC"
}
],
"Eps": "",
"Esid": 133,
"EpsL": "Stumps - day 2",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Western Australia trail Victoria by 88 runs with 7 wickets remaining",
"Ebat": 1,
"TPa": 2,
"TCho": 2,
"Esd": 20230314073000,
"Ese": 20230317073000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "11476",
"Snm": "Plunket Shield",
"Scd": "plunket-shield",
"Cnm": "New Zealand",
"Csnm": "New Zealand",
"Ccd": "new-zealand",
"Scu": 0,
"Events": [
{
"Eid": "778935",
"Pids": {
"8": "778935",
"12": "SBTE_28555788"
},
"Media": {
"12": [
{
"eventId": "2182599",
"provider": "PERFORM",
"type": "LIVE_STREAMING",
"allowedCountries": [
"GB",
"IE",
"NL"
]
}
]
},
"Tr1C1": 186,
"Tr2C1": 282,
"Tr1C2": 103,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 1,
"Tr1CO1": 68.3,
"Tr2CO1": 81.0,
"Tr1CO2": 35.0,
"T1": [
{
"Nm": "Canterbury",
"ID": "86322",
"Abr": "CAN"
}
],
"T2": [
{
"Nm": "Central Stags",
"ID": "86326",
"Abr": "CEN"
}
],
"Eps": "",
"Esid": 134,
"EpsL": "Stumps - day 3",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Canterbury lead Central Stags by 7 runs with 9 wickets remaining",
"Ebat": 1,
"TPa": 1,
"TCho": 1,
"Esd": 20230313030000,
"Ese": 20230316030000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
},
{
"Eid": "778931",
"Pids": {
"8": "778931"
},
"Tr1C1": 405,
"Tr2C1": 221,
"Tr1C2": 206,
"Tr2C2": 17,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 8,
"Tr2CW2": 1,
"Tr1CD2": 1,
"Tr1CO1": 88.1,
"Tr2CO1": 95.2,
"Tr1CO2": 41.0,
"Tr2CO2": 14.0,
"T1": [
{
"Nm": "Northern Districts",
"ID": "86323",
"Abr": "NOR"
}
],
"T2": [
{
"Nm": "Wellington",
"ID": "86321",
"Abr": "WEL"
}
],
"Eps": "",
"Esid": 134,
"EpsL": "Stumps - day 3",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Wellington Firebirds need 374 runs to win",
"Ebat": 2,
"TPa": 2,
"TCho": 2,
"Esd": 20230313030000,
"Ese": 20230316030000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
},
{
"Eid": "778933",
"Pids": {
"8": "778933"
},
"Tr1C1": 454,
"Tr2C1": 351,
"Tr1CW1": 9,
"Tr2CW1": 9,
"Tr2CD1": 1,
"Tr1CO1": 170.0,
"Tr2CO1": 116.0,
"T1": [
{
"Nm": "Otago",
"ID": "86319",
"Abr": "OTA"
}
],
"T2": [
{
"Nm": "Auckland",
"ID": "86320",
"Abr": "AUC"
}
],
"Eps": "",
"Esid": 134,
"EpsL": "Stumps - day 3",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Otago Volts lead Auckland Aces by 103 runs with 1 wicket remaining",
"Ebat": 1,
"TPa": 2,
"TCho": 1,
"Esd": 20230313030000,
"Ese": 20230316030000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "12081",
"Snm": "CSA Four-Day Series: Division 1",
"Scd": "csa-four-day-series-division-1",
"Cnm": "South Africa",
"Csnm": "South Africa",
"Ccd": "south-africa",
"Scu": 0,
"Events": [
{
"Eid": "827681",
"Pids": {
"8": "827681"
},
"Tr1C1": 259,
"Tr2C1": 329,
"Tr1C2": 265,
"Tr2C2": 222,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 7,
"Tr2CW2": 10,
"Tr1CO1": 105.0,
"Tr2CO1": 93.3,
"Tr1CO2": 87.1,
"Tr2CO2": 47.5,
"T1": [
{
"Nm": "DP World Lions",
"ID": "86101",
"Abr": "DPW"
}
],
"T2": [
{
"Nm": "Dolphins",
"ID": "86097",
"Abr": "DOL"
}
],
"Eps": "",
"Esid": 33,
"EpsL": "Play in progress",
"Epr": 1,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Lions need 28 runs to win",
"Ebat": 1,
"TPa": 1,
"TCho": 2,
"Esd": 20230312130000,
"Ese": 20230315130000,
"Exd": 4,
"EO": 6816359,
"Spid": 73,
"Pid": 8
},
{
"Eid": "827678",
"Pids": {
"8": "827678"
},
"Tr1C1": 319,
"Tr2C1": 148,
"Tr1C2": 190,
"Tr2C2": 360,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 1,
"Tr2CW2": 10,
"Tr1CO1": 81.4,
"Tr2CO1": 56.2,
"Tr1CO2": 38.3,
"Tr2CO2": 94.4,
"T1": [
{
"Nm": "Titans",
"ID": "86099",
"Abr": "TIT"
}
],
"T2": [
{
"Nm": "North West Dragons",
"ID": "188954",
"Abr": "NOR"
}
],
"Eps": "FT",
"Esid": 6,
"EpsL": "Finished",
"Epr": 2,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Titans win by 9 wickets",
"TPa": 2,
"TCho": 1,
"Esd": 20230312130000,
"Ese": 20230315130000,
"Exd": 4,
"EO": 6816357,
"Spid": 73,
"Pid": 8
},
{
"Eid": "827679",
"Pids": {
"8": "827679"
},
"Tr1C1": 198,
"Tr2C1": 352,
"Tr1C2": 259,
"Tr2C2": 184,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 10,
"Tr2CW2": 10,
"Tr1CO1": 75.2,
"Tr2CO1": 102.0,
"Tr1CO2": 71.4,
"Tr2CO2": 56.2,
"T1": [
{
"Nm": "Western Province",
"ID": "188949",
"Abr": "WES"
}
],
"T2": [
{
"Nm": "Warriors",
"ID": "86100",
"Abr": "WAR"
}
],
"Eps": "FT",
"Esid": 6,
"EpsL": "Finished",
"Epr": 2,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Warriors win by 79 runs",
"TPa": 2,
"TCho": 1,
"Esd": 20230312130000,
"Ese": 20230315130000,
"Exd": 4,
"EO": 6816357,
"Spid": 73,
"Pid": 8
},
{
"Eid": "827682",
"Pids": {
"8": "827682"
},
"Tr1C1": 212,
"Tr2C1": 493,
"Tr1C2": 319,
"Tr2C2": 39,
"Tr1CW1": 10,
"Tr2CW1": 10,
"Tr1CW2": 10,
"Tr2CW2": 1,
"Tr1CO1": 69.4,
"Tr2CO1": 132.0,
"Tr1CO2": 94.4,
"Tr2CO2": 6.1,
"T1": [
{
"Nm": "Rocks",
"ID": "188956",
"Abr": "ROC"
}
],
"T2": [
{
"Nm": "Knights",
"ID": "86096",
"Abr": "KNI"
}
],
"Eps": "FT",
"Esid": 6,
"EpsL": "Finished",
"Epr": 2,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Knights win by 9 wickets",
"TPa": 1,
"TCho": 1,
"Esd": 20230312133000,
"Ese": 20230315133000,
"Exd": 4,
"EO": 6816357,
"Spid": 73,
"Pid": 8
}
]
},
{
"Sid": "12941",
"Snm": "West Indies Championship",
"Scd": "west-indies-championship",
"Cnm": "West Indies",
"Csnm": "West Indies",
"Ccd": "west-indies",
"Scu": 0,
"Events": [
{
"Eid": "902100",
"Pids": {
"8": "902100"
},
"T1": [
{
"Nm": "Jamaica Scorpions",
"ID": "133543",
"Abr": "JAM"
}
],
"T2": [
{
"Nm": "Windward Volcanoes",
"ID": "133541",
"Abr": "WIN"
}
],
"Eps": "NS",
"Esid": 1,
"EpsL": "Not started",
"Epr": 0,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Teams will be announced at the toss",
"TPa": 0,
"TCho": 0,
"Esd": 20230315193000,
"Ese": 20230318193000,
"Exd": 4,
"EO": 524295,
"Spid": 73,
"Pid": 8
},
{
"Eid": "902103",
"Pids": {
"8": "902103"
},
"T1": [
{
"Nm": "Leeward Islands Hurricanes",
"ID": "133540",
"Abr": "LEE"
}
],
"T2": [
{
"Nm": "Barbados Pride",
"ID": "133545",
"Abr": "BAR"
}
],
"Eps": "NS",
"Esid": 1,
"EpsL": "Not started",
"Epr": 0,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Teams will be announced at the toss",
"TPa": 0,
"TCho": 0,
"Esd": 20230315193000,
"Ese": 20230318193000,
"Exd": 4,
"EO": 524295,
"Spid": 73,
"Pid": 8
},
{
"Eid": "902099",
"Pids": {
"8": "902099"
},
"T1": [
{
"Nm": "T&T Red Force",
"ID": "133544",
"Abr": "T&T"
}
],
"T2": [
{
"Nm": "Guyana Jaguars",
"ID": "133542",
"Abr": "GUY"
}
],
"Eps": "NS",
"Esid": 1,
"EpsL": "Not started",
"Epr": 0,
"Ecov": 0,
"Et": 170,
"EtTx": "Domestic First Class",
"ECo": "Teams will be announced at the toss",
"TPa": 0,
"TCho": 0,
"Esd": 20230315193000,
"Ese": 20230318193000,
"Exd": 4,
"EO": 524295,
"Spid": 73,
"Pid": 8
}
]
}
]
}
当请求中的日期更改时,结构将更改,结构中的更改仅发生在“阶段”和“事件”中
我使用“Stages[0]”“Stages[1]”等访问事件,使用“Events[0]”“Events[1]”访问阶段中的事件,但有时“Events[1]”并不存在,使用不同的组件迭代所有事件非常耗时
我是新的编码,我没有很好的经验,在这一领域,所以请帮助将不胜感激:)
1条答案
按热度按时间yruzcnhs1#
好的,根据你的评论,你只想循环
Events
中的值。你的想法是好的,使用Events[0]
,Events[1]
等,但这不会工作,因为它的硬编码。相反,你应该循环的对象:现在,您可以对事件执行一些操作,就像您当前正在执行的操作一样:
一些其他来源,这可能对你有用:React loop over an object with array