Merge branch 'bugfix/json-to-csv' of https://github.com/MShwed/CyberChef into MShwed-bugfix/json-to-csv

This commit is contained in:
n1474335 2019-06-27 15:36:12 +01:00
commit d7e4c28cd0
3 changed files with 100 additions and 0 deletions

View file

@ -51,6 +51,10 @@ class JSONToCSV extends Operation {
this.rowDelim = rowDelim;
const self = this;
if (!(input instanceof Array)) {
input = [input];
}
try {
// If the JSON is an array of arrays, this is easy
if (input[0] instanceof Array) {
@ -89,6 +93,8 @@ class JSONToCSV extends Operation {
* @returns {string}
*/
escapeCellContents(data) {
if (typeof data === "number") data = data.toString();
// Double quotes should be doubled up
data = data.replace(/"/g, '""');