I am setting up a workflow to use the Google API to lock or unlock a Chrome device. I have most aspects working, but the trouble I am running into is that Google’s API returns things as an array of strings which is causing my next API call to be something like ‘ <device id>]’ instead of ‘<device id>’. Even if I add the array element I want in this case t0] my value is still wrapped in r ]. Is there a simple way to strip the square brackets, or do I have to create expressions for each json array I want to use down the line?
Facing the same issue. Hope someone has a solution for this.
I ended up mapping index 0 of the array to a custom variable in my json parser for the api response from Google.
Seems not a 1-to-1 match to my issue but I was able to find a solution.
Sharing it here so others can benefit from it.
I wanted to capture the last added note in a change ticket, so in the JSON parser I added a new variable with h-1:]
This output was with “h]” and “”. To have that removed I just a liquid filter
{{P1.root.notes.notes_object.body.body_text_last | replace: '|', '' | replace: ']', '' | replace: '"', '' | sanitze_html }}
You could also use the expression builder node to produce a substring that removes the unnecessary characters.
This allows the result of the expression to be used later on in other locations of the workflow as well.
I recently ran into this same issue with passing a requester id for a PUT api call and found that I had to change the index to 0 for the path variable and change the Type for the field to be number instead of array of numbers.
Seems not a 1-to-1 match to my issue but I was able to find a solution.
Sharing it here so others can benefit from it.
I wanted to capture the last added note in a change ticket, so in the JSON parser I added a new variable with h-1:]
This output was with “h]” and “”. To have that removed I just a liquid filter
{{P1.root.notes.notes_object.body.body_text_last | replace: '|', '' | replace: ']', '' | replace: '"', '' | sanitze_html }}
Rather then using replace you can use | remove: “]” | remove: “o”
Reply
Sign in to the Community
Social Login
Login for Freshworks Employees Login with LinkedInEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.