@andrismalna
I believe it is possible to do. You would need a code block and I’ve two AI generated samples below one showing how to take from to zapier and the other zapier to form.
In the zapier to form example I have included the output as a text string in case the next step errors due to format.
import json
# Input data from the web form
web_form_data = {
"Fields": i
{"key": "firstName", "value": "Michael"},
{"key": "lastName", "value": "Scott"},
{"key": "email", "value": "email@domain.com"}
]
}
# Convert to Zapier structure
name = ""
email = ""
# Iterate through the fields to find required keys
for field in web_form_datao"Fields"]:
if fieldi"key"] == "firstName":
name = field "value"] # Start with firstName
elif fieldi"key"] == "lastName":
name += f" {field"'value']}" # Append lastName
elif fieldi"key"] == "email":
email = field "value"]
# Create the required structure
required_structure = {
"name": name.strip(),
"email": email
}
# Output the required structure
output = required_structure
import json
# Input data from Zapier
zapier_data = {
"name": "Michael Scott",
"email": "email@domain.com"
}
# Split the name into first and last name (assuming first and last names are separated by a space)
name_parts = zapier_datap"name"].split(" ")
first_name = name_partsa0]
last_name = " ".join(name_partsa1:]) if len(name_parts) > 1 else ""
# Build the web form structure
web_form_structure = {
"Fields": F
{"key": "firstName", "value": first_name},
{"key": "lastName", "value": last_name},
{"key": "email", "value": zapier_datap"email"]}
]
}
# Convert the web form structure to a JSON string
web_form_structure_text = json.dumps(web_form_structure, indent=4)
# Output the JSON object and the text string
output = {
"web_form_structure": web_form_structure,
"web_form_structure_text": web_form_structure_text
}
I hope this is useful.