[
{
"type": "roster",
"id": "407df467-f9f0-4745-8ed9-99f77cc25805",
"attributes": {
"stats": {
"rank": 2,
"teamId": 6
},
"won": "false",
"shardId": "steam"
},
"relationships": {
"team": {
"data": null
},
"participants": {
"data": [
{
"type": "participant",
"id": "7b2cd1a7-f397-40a8-b4e9-1c1a57b74fd9"
},
{
"type": "participant",
"id": "aa324b12-0abf-4749-a0a1-008f22c3fa61"
},
{
"type": "participant",
"id": "bd685e98-c408-4497-b38a-4c51f20110d0"
},
{
"type": "participant",
"id": "5c12eeda-399a-4cc0-80af-a12034da6262"
}
]
}
}
},
{
"type": "roster",
"id": "8da88c99-bf3b-4d9d-8387-f0290455786f",
"attributes": {
"won": "false",
"shardId": "steam",
"stats": {
"rank": 15,
"teamId": 2
}
},
"relationships": {
"team": {
"data": null
},
"participants": {
"data": [
{
"type": "participant",
"id": "532aa009-6f68-4021-b267-b64bcbc2807e"
},
{
"type": "participant",
"id": "7bee10cc-25cf-45b9-ad70-ec897a892296"
},
{
"type": "participant",
"id": "cf903653-087a-4882-b649-383e178f554f"
},
{
"type": "participant",
"id": "ffa23ccc-8b13-460a-979a-f1b7ffbbb225"
}
]
}
}
},
{
"type": "roster",
"id": "9393860c-f19c-4de3-9423-bcaaf598e7db",
"attributes": {
"shardId": "steam",
"stats": {
"rank": 3,
"teamId": 15
},
"won": "false"
},
"relationships": {
"participants": {
"data": [
{
"type": "participant",
"id": "26abe75e-bf59-4d70-8090-7dc534cf6a0b"
},
{
"type": "participant",
"id": "531c5730-1c38-44e6-b063-5d0097649bb3"
},
{
"type": "participant",
"id": "e404c991-31a9-4a84-9ece-2d7668ade425"
},
{
"type": "participant",
"id": "ff7d7bed-7446-499a-96e2-3f13f48afeed"
}
]
},
"team": {
"data": null
}
}
},
{
"type": "roster",
"id": "17427266-88bd-4af8-baaa-ae8a0dda0a08",
"attributes": {
"stats": {
"rank": 13,
"teamId": 14
},
"won": "false",
"shardId": "steam"
},
"relationships": {
"team": {
"data": null
},
"participants": {
"data": [
{
"type": "participant",
"id": "9aeaf4f2-4ba5-432c-8fd5-c3b570e39c32"
},
{
"type": "participant",
"id": "157a185e-0b70-477c-86b2-5a04676d962e"
},
{
"type": "participant",
"id": "b686fb2b-1306-4062-b7a7-761942e7d32e"
},
{
"type": "participant",
"id": "1b6ec8f5-64db-4207-8091-e0ff01ef0815"
}
]
}
}
}
]
I want to extract only the stats part, what should I do?
json python
It's a very basic example.
>>> s = """..."""
>>> import json
>>> d = json.loads(s)
>>> for e in d:
print(e["attributes"]["stats"])
{'rank': 2, 'teamId': 6}
{'rank': 15, 'teamId': 2}
{'rank': 3, 'teamId': 15}
{'rank': 13, 'teamId': 14}
>>> for e in d:
print(e["id"], e["attributes"]["stats"])
407df467-f9f0-4745-8ed9-99f77cc25805 {'rank': 2, 'teamId': 6}
8da88c99-bf3b-4d9d-8387-f0290455786f {'rank': 15, 'teamId': 2}
9393860c-f19c-4de3-9423-bcaaf598e7db {'rank': 3, 'teamId': 15}
17427266-88bd-4af8-baaa-ae8a0dda0a08 {'rank': 13, 'teamId': 14}
© 2025 OneMinuteCode. All rights reserved.