german
1
Hi there! First request for help in 2 years.
For some reason this call breaks when broker_folder_name contains the character ’
CALL
Even if being escaped with JSON-safe
I can confirm that:
- removing the character makes the call work
- trying to initialize the call with the character also breaks the call and has been impossible to initialize it with it, regardless of trying to escape it with \ or double \ \ (no space between)
HELP! Thanks in advance
Unfortunately this expression “Json Safe” is not really realiy safe 
J805
3
If JSON safe doesn’t work you can use ‘find and replace’ for the characters that you are aware of. It’s just not a very good solution since there might be more down the line that you might need to fix.
Maybe send a bug report so they are aware of that. 
1 Like
german
4
Thanks for the help. The problem is that the name is dynamic and it may or may not contain the character so find&replace won’t do it.
Hoping some bubble guru can step in and shed some light on whether this is really a bug or not
J805
5
Well, if it doesn’t find anything, then it won’t replace anything. But sure, you can wait for a Bubble Guru to answer.
2 Likes
german
6
Wait I just realized you are a Guru! 
I’d love to solve this without a patch that may create technical debt though. Let’s see…
2 Likes
J805
7
You can also try using ‘find and replace’ using a regex. Might be a better catch all option. 
Would be really nice to submit a big report for this. So all of us can rest easy knowing it’s been reported and fixed
1 Like
german
10
I will report the bug to Bubble and post answers here, unless someone else chips in.
1 Like
Jici
11
I personnaly think it’s an issue with the API service and not Bubble.
Single quotes doesn’t need to be escaped in JSON. You can check with jsonlint to validate the JSON.
However, the API service could have issue with special characters. Which API are you calling? Which error do you get?
german
12
Thanks for this insight! I thought so too. Some notes:
- It’s our own API service. It’s a very silly service that creates Folder on G Drive.
- JSON lint OK.
- Once we noticed this error we modified the API no make sure this would not cause an issue,
- However, upon “fixing” and then trying again, it would still not work.
- The call to our API works without the character via Bubble AND via POSTMAN (with and without character). Hence we assume the API is not the issue.
- I found this online, upon trying to add \ to the folder name in Bubble when initializing the call, the call breaks with message like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>SyntaxError: Bad escaped character in JSON at position 91<br> at JSON.parse (<anonymous>)<br> at parse (/api/node_modules/body-parser/lib/types/json.js:92:19)<br> at /api/node_modules/body-parser/lib/read.js:128:18<br> at AsyncResource.runInAsyncScope (node:async_hooks:206:9)<br> at invokeCallback (/api/node_modules/raw-body/index.js:238:16)<br> at done (/api/node_modules/raw-body/index.js:227:7)<br> at IncomingMessage.onEnd (/api/node_modules/raw-body/index.js:287:7)<br> at IncomingMessage.clsBind (/api/node_modules/cls-hooked/context.js:172:17)<br> at IncomingMessage.emit (node:events:518:28)<br> at IncomingMessage.emitted (/api/node_modules/emitter-listener/listener.js:134:21)</pre>
</body>
</html>```
Jici
13
I see. So in this case, find & replace is you best option. I don’ expect Bubble to do modification to json-safe function.
german
14
Thanks. Can you elaborate how find& replace would be better?
I mean since manually adding the \ character at call initialization does not work anyway, why would find&replace work? What am I missing?
Thanks all for helping solve this mistery!
Jici
15
You said it work in Postman? Can share what you have set in postman? Body and headers?
german
16
Headers ( there is additionally a key sent with the request)
I can share the endpoint privately if needed.
Body
{
"parent_folder_id": "XXXXXXX", // place the folder ID of your GDrive folder where you want to folder to be created
"broker_folder_name": "Ledger's of FOOLAND ", // name of the folder you want
"sub_folders": ["clients", "templates"] // list of subfolders wanted.
}```
german
17
It worked adding 2 backlashes \ \ (and escape one and another). The G Drive API doe snot give error but obviously it’s not the expected result

german
18
Case closed folks. As embarrassing as it is to admit, the issue was that the URL of the endpoint was changed (new deployment that acepted the ’ character), but not changed on the plug-in so we were making the call to “broken api”. Nothing else. I feel like a total fool. Sorry for wasting everyone’s time and thanks for the help.
2 Likes