kramwe
June 5, 2020, 11:50am
1
Anyone have regex or a function for stripping out characters from API calls that cause json to break?
I’m looking for a easy way to escape characters on all API text fields we post to other tools
Maybe bubble could add as a :: formatting option?
Folks with same request…
http://forum.bubble.io/search?q=json%20remove%20break
Hi,
Quick question…
If I have a multi-line input element setup, and I wanted to use it’s value as a source of data to be parsed into an API request, then do we have anyway to validate the data first in Bubble?
“VALUE”:“MyMultiLineInputFieldValue”
Reason I ask is because I’m thinking if double quotes (for example) are typed into it, then it will break the request?
Do we have anything in Bubble like a JSON parser that will check for things like that? Or do we need to use Regex/Find & Replace? …
In the past when I’ve had this problem, I’ve used 2 Find and Replace commands in succession of one another, like so…
The first one looks for a backslash, the second one looks for double quotes.
Each of those are escaped by adding a backslash before it.
That’s done the trick for me and I’ve not needed anything else. You could try it and see if it helps.
2 Likes
kramwe
July 1, 2020, 11:30am
3
Yes, this is also what we’re doing to 50-100 fields in our app where we’re posting data to external endpoints. /n is another to escape which in Find/Replace is an actual “return”. Hardcoding /n doesn’t work.
@kramwe - I know it’s a year after you made this post but was wondering how you searched and replaced for the line breaks to make sure they didn’t get into the JSON file. I tried searching for ‘/n’ and replacing with ‘/n’ but that didn’t seem to work.
Thanks in advance for any suggestions.
kramwe
April 21, 2021, 9:01am
5
just press return in top “find” box. will look like nothing.