From 3a9bdc58af2f6c7d65d6e1da834f7c88a7162188 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Tue, 16 Feb 2021 14:36:31 +0000 Subject: [PATCH] Fixed 'JSON to CSV' handling of complex structures. Closes #637 --- src/core/operations/JSONToCSV.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/operations/JSONToCSV.mjs b/src/core/operations/JSONToCSV.mjs index 2685c8f8..127f6dbb 100644 --- a/src/core/operations/JSONToCSV.mjs +++ b/src/core/operations/JSONToCSV.mjs @@ -113,11 +113,12 @@ class JSONToCSV extends Operation { */ escapeCellContents(data) { if (typeof data === "number") data = data.toString(); + if (typeof data !== "string") data = JSON.stringify(data); // Double quotes should be doubled up data = data.replace(/"/g, '""'); - // If the cell contains a cell or row delimiter or a double quote, it mut be enclosed in double quotes + // If the cell contains a cell or row delimiter or a double quote, it must be enclosed in double quotes if ( data.indexOf(this.cellDelim) >= 0 || data.indexOf(this.rowDelim) >= 0 ||