So just a little context first, I'm writing a small JS app that displays sports information. Basically I am working with an NBA api that has all teams and all players. What I'd like to do is periodically call the AllTeams and AllPlayers endpoints, receive the data, then store the data in a local JSON file.
At the moment the data from the AllTeams endpoint looks like:
And the player data looks like:
However in my local json file I'd like each team to have a key of "players" and then store the players from the AllPlayers endpoint according to team.id
Just to clarify I don't have a problem with doing the api calls etc the bit that I'm not sure how to do is set a structure for my json file and save the actual data from the two endpoints in that json file.
The structure I'd like is something like this:
Thanks, Bez