Created
February 24, 2021 03:26
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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