I have this JSON file. I would like to query only the Post-Game categories, however, I need the last two of them.
{
"videos" : [
{
"url" : "https://www.youtube.com/watch?v=DSorwgunfqo",
"category" : "Pre-Game",
"team" : ["Rodholfo Silva"],
"date" : "January 20th 2021"
},
{
"url" : "https://www.youtube.com/watch?v=qFzxV0Dc2rw",
"category" : "Post-Game",
"team" : ["Rod Patrón"],
"date" : "January 21st 2021"
},
{
"url" : "https://www.youtube.com/watch?v=nq0358cJb-M",
"category" : "Post-Game",
"team" : ["Rod Patrón"],
"date" : "January 17th 2021"
},
{
"url" : "https://www.youtube.com/watch?v=iALl-ce5dzY",
"category" : "Pre-Game",
"team" : ["Rodholfo Silva"],
"date" : "January 16th 2021"
},
{
"url" : "https://www.youtube.com/watch?v=UY4WvV3dHNY",
"category" : "Enterviews",
"team" : ["Mathew Francis, Rodholfo Silva, Rod Patrón"],
"date" : "July 16th 2020"
},
{
"url" : "https://www.youtube.com/watch?v=7E2hMsmdbd4",
"category" : "Post-Game",
"team" : ["Rod Patrón"],
"date" : "January 24th 2021"
}
]
}
I am using Javascript, via for
loops and slice(1).slice(-2)
, but not success.
question from:
https://stackoverflow.com/questions/65910849/query-category-via-json-with-javascript 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…