mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 06:01:02 +01:00
Fixed 'JSON to CSV' handling of complex structures. Closes #637
This commit is contained in:
parent
59c1c45d78
commit
3a9bdc58af
@ -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 ||
|
||||
|
Loading…
Reference in New Issue
Block a user