How do I load an entire JSON file that is written in the form of dictionaries? It is also so that it remains as a graph. The constellations are the largest "group", they have the name, in this case "Donkey Constellation" and it has some stars, the main one and the others that are connected to it.
"constellations": [
{
"name":"Constelación del Burro",
"stars":[
{
"id": 1,
"label": "Alpha1",
"linkedTo": [
{
"starId": 2,
"distance": 120
},
{
"starId": 4,
"distance": 87
},
{
"starId": 5,
"distance": 101
}
],
"radius": 0.4,
"timeToEat": 3,
"amountOfEnergy": 1,
"coordenates": {
"x": 25,
"y": 34
},
"hypergiant": false
}]
]
]
The quoted json is missing a brace before the last bracket, so to read the file and convert it we do the following
Edit: I forgot about the graph, although I'm not entirely clear what it looks like and what its output would be, we can use pydot for that job.
We go through the dictionary for each constellation, each star is added and for each star its links, we save it in a file in png format.
This is the graph generated for the cited example