The goal is to receive JSON, modify 1 property, then send it to a webhook.
What is the problem & what have you tried?
I’ve tried using built-in function change the data (IF and CONVERT). I’ve tried modifying the data using a variable and then injecting that into the JSON. Nothing seems to work.
This doesn’t appear to work: if(1.sex {{=}} Non-Binary, Gender Fluid, Gender non-conforming, or Gender queer; Non-Binary; 1.sex)
1.sex is the property I am receiving into my JSON object. It’s too long for the out going recipient.
You can try using the replace function with a pattern instead.
{{replace(1.sex; "/^(Non-Binary, Gender Fluid, Gender non-conforming, or Gender queer)$/i"; "Non-Binary")}} Make Input Markup: Copy-paste the above into the field, including start/end curly brackets for it to import as intended
This replaces an exact match, but not case-sensitive.
Thank you for jumping in on my question. Unfortunately that did not work. I copy/pasted the code exactly like you suggested. Initially, the double quotes were automatically removed after copying the code snippet:
Neither way worked. I’m now going to go down a regex internet rabbit hole to see if I can find alternate solutions. If you have any other ideas I would love to see them! Much appreciated.
If you need further assistance, please provide the following:
1. All Relevant Screenshots
We need to see what you’re working with to give you the best advice. Screenshots are important because Make is a visual editor — a picture provides us with more context.
It would help us identify the issue by having screenshots of:
relevant module input/output bubbles
3. Properly-formatted Output Bundles from a Scenario Run
Please provide the input/output bundles of each of the relevant modules by running the scenario, or get the bundles from a previous run from the Scenario “History” tab.
Providing the bundles from a scenario run will allow others to replicate what is going on, especially if there are complex data structures (nested arrays and collections) and external services. This helps mapping the correct raw variable names from collections (instead of the label/display name).
Format bundles or JSON with the Code button. See instructions:
View Details ◀
Click on the white speech bubbles on the top-right of each module and select “Download output (or input) bundles”.
A. Upload a Text File
Save each bundle contents in a plain text editor as a moduleNumber-output.txt file. Open the file to check if it has not added additional formatting or encoded the plain text.
You can upload files and images to this forum by clicking on the upload button:
‘‘‘
I’ve obscured some of the information for privacy reasons. The “sex” property is the important bit of course.
Input into the JSON is very interesting in that it doesn’t match the outgoing from the webhook:
I’m sending the data to the Google Sheet as an added insight into what is coming from the JSON object. This is what ends up in the google sheet:
I’m very confused as to why the JSON in and out data shows “Non-Binary” but the data before and after shows the super long version of the gender.
Thoughts?
Ok so this is showing that the formula is working. And the issue is that whatever you are sending this to is expecting some other value inside the gender field. So where are you sending this data? Check the documentation and the data structure there to see what’s expected.
Also what are you mapping inside the Google sheet?
The data that is flowing through the HTTP Make A Request object is going to a 3rd party that I have no control over. According to them, they can only accept “Non-Binary” as the value. I’ve emailed them and am waiting on a response to see if they can provide more insight.
As for the Google Sheet, I’m not mapping anything. I’m just dumping the JSON data in there so I can see what is coming through. The fact that the gender is coming through as the long string is baffling to me given that the input and output of the JSON shows only “Non-Binary”.