diff --git a/src/components/DataExportSection.vue b/src/components/DataExportSection.vue index 647beb19..9bdc1a9a 100644 --- a/src/components/DataExportSection.vue +++ b/src/components/DataExportSection.vue @@ -131,7 +131,20 @@ export default class DataExportSection extends Vue { */ public async exportDatabase() { try { - const blob = await db.export({ prettyJson: true }); + const blob = await db.export({ + prettyJson: true, + transform: (table, value, key) => { + if (table === "contacts") { + // Dexie inserts a number 0 when some are undefined, so we need to totally remove them. + Object.keys(value).forEach(prop => { + if (value[prop] === undefined) { + delete value[prop]; + } + }); + } + return { value, key }; + }, + }); const fileName = `${db.name}-backup.json`; if (this.platformCapabilities.hasFileDownload) {