I need to use a JSON file created by one of the views in some D3 code in a template. I can load the file with D3 with
d3.json("nameOfTheFile.json", function (error, data) {
// ...
}
How can I create and serve this file from a Flask view? When I run the same script from IPython notebook I export the file with
dataFrame.to_json(nameOfTheFile.json, orient='records', date_format='iso')
but that instruction does not work from the view.