Created
April 16, 2021 14:52
-
-
Save simonc/b3515b2f0e97d9a7a5fc1647e7886264 to your computer and use it in GitHub Desktop.
Code by Zapier - JavaScript code to clean data for JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data = Object.assign({}, inputData); | |
for (let key in data) { | |
if (typeof(data[key]) === "string" && data[key].length > 0) { | |
data[key] = data[key].replace(/\r?\n/g, "<br>").replace(/\t/g, " ").replace(/"/g, '\\\"'); | |
} | |
} | |
output = [data]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment