Skip to content

Instantly share code, notes, and snippets.

@maks
Created February 24, 2021 03:26
Show Gist options
  • Save maks/2225434160576abbdaf78fa5132bb2ce to your computer and use it in GitHub Desktop.
Save maks/2225434160576abbdaf78fa5132bb2ce to your computer and use it in GitHub Desktop.
very basic code for converting the export json from www.notesforandroid.com app back to folder ot text files
import 'dart:convert';
import 'dart:io';
void main() {
final f = File('data.json');
String input = f.readAsStringSync();
print("len: ${input.length}");
final json = jsonDecode(input);
final notecount = json["notes"].length;
print('notes: $notecount');
final timer = Stopwatch()..start();
for (var i = 0; i < notecount; i++) {
final title = json["notes"][i]['title'];
final text = json["notes"][i]['text'];
final notefile = File('notes/${title}.md');
notefile.writeAsStringSync(text, flush: true);
stdout.write('.');
}
timer.stop();
print('finished in ${timer.elapsedMilliseconds}ms');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment