I was wondering how I could go about splitting this json into 3 different movie types in order for me to better retrieve each movies rating and then return a list, showing them from highest to lowest rating. I have tried pythons split("}") but then I got an error saying it's no longer a json object and should not be a list when I am trying to perform my other operations such convertToJSON() function. This also didn't work well to split the movies correctly
import json
def convertToJSON(movieData):
return json.loads(movieData)
#JSON string python object
Data = """[{ "title": “Spider-Man Homecoming”,
“Studio: “Marvel”, “Rating”: 98, “videoType: “Movie" },
{ "title": “Avengers Endgame”,
“Studio: “Marvel”, “Rating”: 90, “videoType: “Movie" },
{ "title": “Godzilla vs Kong”,
“Studio: “
Warner Bros. Pictures”, “Rating”: 89, “videoType: “Movie" }]”””
I am trying to split to return somehow a list like this:
'Spider-Man Homecoming': 98
'Avengers Endgame': 90
'Godilla vs Kong': 89