'how do I get into a [ .jason objekt = .py dictionary ] to delete stuff

so I have this .json file:

{
  "stage": "REGULAR_SEASON",
  "type": "TOTAL",
  "group": null,
  "table": [
    {
      "position": 1,
      "team": *{
        "id": 678,
        "name": "AFC Ajax",
        "crestUrl": "https://crests.football-data.org/678.svg"
      },*
      "playedGames": 26,
      "form": null,
      "won": 20,
      "draw": 3,
.......

and I would like to call for a row in an DataFrame by the name of the 'team', but my df looks like this:

             position---team--- playedGames--- ... ..... ...  
                0        !            26           ...
                1        !            26               ...
                2        !            26       ..     ..   .. 
                         !
                         !
                         Y
  *{'id': 678, 'name': 'AFC Ajax', 'crestUrl': 'https://crests.football-data.org/678.svg'}*
  {'id': 674, 'name': 'PSV', 'crestUrl': 'https://crests.football-data.org/674.png'}
  {'id': 675, 'name': 'Feyenoord Rotterdam', 'crestUrl': 'https://crests.football- 
   data.org/675.svg'}

so I was thinking of somehow splitting the strings in the columns 'team' (df)

or

even better navigating to the tag? 'team' and deleting the other tags? 'id', 'crestUrl' (.json)

some ideas would be nice and this is my code:

connection.request('GET', f'/v2/competitions/{id_for}/standings', None, headers )
response = json.loads(connection.getresponse().read().decode())

for standing in response['standings']:
    sta = standing 
    
with open ('new_tabel.json', 'w') as f:
    json.dump(sta['table'], f, indent = 2)

tabel = pd.read_json('new_tabel.json')
del tabel['form']


Team_2 = tabel.loc[tabel['position'] == 2]
Team_PSV = tabel.loc[tabel['team'] == 'PSV']


excel_checkout = tabel 
x = pd.ExcelWriter('test.xlsx')
excel_checkout.to_excel(x)
x.save()

print(Team_2)
print(Team_PSV)

print(json.dumps(response, indent =2)) 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source