so i have the results come back in a
so i have the results come back in a json text but i wanna edit the string, replace certain characters etc
18 Replies
You can change the response type from node editor or from the code editor manually, to replace certain characters or perform any operations on the string, you can use Regex.
this isnt the right syntax do you know how i can wrap it so i can return the modified string?
the (x)text variable is the result of an API call
i wanna modify it tho, i need to clean up the string
seems like the node editor just sends back the whole string instead of doing the code and then sending it back?
To remove the string you can use Slice method. You'll have to check if the regex is correct. You can fiind all the methods here - https://www.geeksforgeeks.org/delete-first-character-of-a-string-in-javascript/. Then include regex in it if required.
i know there are alot of ways to do it but it seems like the editor isnt processing the code? or something is missing
seems like the only thing that works in the node editor is just having the (x)text variable
You can confirm it by checking the value of the string (text).
that is with just this
it returns a json, the (x)text is a json body result
Okay, the issue here is - The response is of type array, you are adding operation/method of string, you'll require to convert it to string or extract from the array index.
ooo
thing is the type just by itself is a string
the json body format is results --> text and its always a string
ok so yeah it is an array
i see it in the api
lol
feel like this is being overly complicated
the string comes back fine, i just need to trim it in buildship before it sends it to the front end
actually i figured it out i found some nodes lol, the convert to string node works
and then the replace string node
;D
thx for the tips 😉