Simple Javascript Code to parse strings to objects in Zapier

Zapier is a great automation tool. I use it for a multitude of services. Recently I had a problem where Ninja forms asked me to pay if I want its integration with Zapier or Trello. So I came up with this shortcut. In Ninja forms add a step to send email to zapier and use the following code in javascript module. Code is self explanatory.

Each new variable sits in a new line or “\n”
Variable name and values are separated as “:

var desc = inputData.description;
var returnObj = new Object();
desc.split("\n").forEach(function(item,index){
	var splitItems = item.split(": ");
	returnObj[splitItems[0]] = splitItems[1]
});
return returnObj;

Hope you find it useful. Comment if you need a detailed post.

Leave a Reply

Your email address will not be published.