Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Node script to convert simple note json output to standard text files
var fs = require('fs');
var notesString = fs.readFileSync('simplenote_export.json', 'utf8');
var notesArray = JSON.parse(notesString);
console.log('you have '+notesArray.length+' notes');
for (var i = notesArray.length - 1; i >= 0; i--) {
var filename = notesArray[i].content.substr(0,30)
filename = filename.replace(/(\r\n|\n|\r|\/|\\|<|>|:)/gm," ");
filename = filename.replace(/\s+/g," ");
var newNote = fs.openSync('result/'+filename+'.txt','w');
fs.writeSync(newNote, notesArray[i].content);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment