Using Flask, I've attempted to load a static JSON file using send_from_directory
. From this I get a Response
object. I cannot get this object in JSON format; however.
courses = send_from_directory("static/", "courses.json");
courses["math"] # not a JSON - cannot get math element from loaded courses
jsonify(courses) # Object of type Response is not JSON serializable
How would one go about converting a response into JSON format, then?
edit: To clarify - I'm not looking to return a file and a JSON. I am seeking to get a dict
from a JSON file that is located within "/static" in the working directory.