Persistence - piotrpdev/notes-app GitHub Wiki

The app allows you to persist your notes using XML, JSON, or YAML.

XML is used by default, but you can change which one is used by switching the commented line in Main.kt:

private val noteAPI = NoteAPI(XMLSerializer(File("notes.xml")))
//private val noteAPI = NoteAPI(JSONSerializer(File("notes.json")))
//private val noteAPI = NoteAPI(YAMLSerializer(File("notes.yaml")))

Dependencies

These are the Maven dependencies that handle persistence for each data format:

Since the only thing being stored is an ArrayList of notes, the files usually turn out pretty simple:

See also

For instructions on how to load your notes from a file, see the wiki section on "Load Notes from File"

For instructions on how to save your notes to a file, see the wiki section on "Save Notes to File"