I\'m trying to write a Json object (JsonExport) and I\'d like to write its content into a text file.
I\'m using max4live to export data from Audio DAW to Json in order t
If you have access to an already existing file, just link to it. You can specify what the downloaded file name will be like this:
Download as JSON
If needed, you could also write out the dataURI as well
//Get the file contents
var txtFile = "test.txt";
var file = new File(txtFile);
var str = JSON.stringify(JsonExport);
//Save the file contents as a DataURI
var dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(str);
//Write it as the href for the link
var link = document.getElementById('link').href = dataUri;
Then just give the link an ID and a default href
Download as JSON