nutritionfactsorg / daily-dozen-android

Keep track of the foods that Dr. Greger recommends in his NYT's best-selling book, How Not to Die with this Android app
https://play.google.com/store/apps/details?id=org.nutritionfacts.dailydozen&hl=en
Other
274 stars 95 forks source link

Local Backup & Backup Format #238

Open befocken opened 11 months ago

befocken commented 11 months ago

Hi, first of all thank you for the great app :).

When I recently tried to backup the data of the app, I noticed that there is no option to just export the file locally, only to share it via mail, messenger etc. I think it would be nice to have the option to just export it to the local storage (and let the user then decide on how they want to actually backup the data - e.g. copy it to a USB drive or directly onto another phone). Personally, I would prefer that over the current way, were you have to share (and thus send) the somewhat private data via some more or less secure service. But I think at least the option to save it locally would be nice.

Moreover, after sending it to myself via a secure messenger, I took a look at the generated file. Apart from the fact that I agree with #220 and would appreciate a more specific filename than dailydozen_backup.json, I noticed that it actually isn't a JSON file...

The format is one JSON-Object per line, without being in an array and without being separated by a comma, so not valid json:

{...}
{...}
{...}

Valid JSON would look like this:

[
  {...},
  {...},
  {...}
]

Is there a reason for this?

Especially when wanting to export the data and evaluate it, it is somewhat cumbersome and unexpected (and possibly even error-prone on the coding-side as some parsing libraries might not like) that it isn't actual JSON.