Here is what happens:
I am using a very cool plugin in my Shopify store that allows you to customise your product following a sequence of steps.
Problem is that all of this information is not sorted for Zapier. Essentially it displays as this:
They come as " Line Items Properties Values " and "Line Items Properties Names" and when pasted they come as an array.
What I would need to do is to match those Names with their Values. And if possible be able then to select in the GUI of Zapier.
So instead of having these fields and values
"Line Properties Names" -> "Project Title","Project Description","Ebook Type"....
"Line Items Properties Values" -> "Sherlock Holmes","A story in London..", "Standard Book"...
Having these fields and values:
"Project Title" -> "Sherlock Holmes"
"Project Description" -> "A story in London.."
"Ebook Type" -> "Standard Ebook"
Would it be possible?
Thank you for your time
UPDATE
For clarification purposes
So, in this order there are 3 different products. Separated by []. Values within the product can vary, for instance if a customer decides to not fill the field of " Project Details ", then Project Details Keys and Value wont display. Resulting essentially in products with different amount of keys and values.
Here is an example: (As you can see the first product has a different set of values as the second product)
Input data
Input data Values: ["1","ebook1524837342394","Ebook~~//www.shappify-cdn.com/images/282516/127828455/001_Ebook Technical 325x325 (1).png~~ebook","Technical Ebook","Technical 15K - $450.00","All Inclusive Package - $149.00","Cookbook Instant Pot"],["ebook1524837342394"],["Detective Story based in London......","Sherlock Holmes","No Addons","No Package","10000 Words - $270.00","Fiction Book","Ebook~~//www.shappify-cdn.com/images/282516/127828453/001_Ebook Standard 325x325.png~~ebook","ebook1524837304725","1","https://cdn.shopify.com/s/files/1/0012/8814/2906/uploads/7ddee14d6e5d6c5e4396981d1702c375.jpg"]
Input data Keys: ["_master_builder","_builder_id","_builder_info","Ebook Type","Word Count","Upgrade","Project Title"],["_builder_id"],["Project Details","Project Title","Addons","Upgrade","Word Count","Ebook Type","_builder_info","_builder_id","_master_builder","Upload your file here"]
What I want to do
I want to match the key with their value and be able to select them on the Zapier GUI.
Current output with the code proposed
Expected Output
[{"_master_builder":"1","_builder_id":"ebook1524837342394","_builder_info":"Ebook~~//www.shappify-cdn.com/images/282516/127828455/001_Ebook Technical 325x325 (1).png~~ebook"...}]
Appreciate your help guys
2
Answers
This should be possible with a
for
loop. Try this.In your example, define the first box as values and the second as keys. Remove the
var inputData...
lines before running the code step.Ah! So this is a little trickier than it looked at first, but it’s not bad. There are two gotchas:
So once we parse it out correctly, it’s not too bad.
As is, there’s a lot of repeated keys keys so the output is smaller than the input. You can also tweak this code to match your input better if you want to group the output differently.
Hope that helps!