1π
It seems a waste of a round trip to send your data to the server and ask it to create a CSV when you can quite easily do that in the javascript itself. Less load on the server, faster response.
Assuming your link is like
<a href="" id="download_link">Download CSV</a>
Then
function to_csv(json_data, header, info){
var s = "data:text/csv,"
for (var key in json_data) {
if (json_data.hasOwnProperty(key)) {
s += json_data[key];
}
}
}
π€e4c5
0π
Solved this by using json.loads:
g_data = json.loads(request.GET.get('json_data'))
π€Matt Mateo
Source:stackexchange.com