#iFrame question

1 messages · Page 1 of 1 (latest)

ocean lily
#

Just noticed that discord is adding formatting of it's own and adding escape characters only works in some places so i'll try to expalin it. I'm trying to get a gallery working using the iFrame widget. When i type in the list of images everything works. The JSON object has a key enclosed in double quotes and a url also enclosed in double quotes. When i try to substitute it with the results from a query the double quotes inside the JSON get escaped with a backslashes.

var json = { "slider": {{Query1.data}} }; results in a JSON object that would workd EXCEPT that the double quotes are escaped with a backslash.

Any pointers as the why the back slashes are being added or how to get rid of them?

tired emberBOT
#

Hey There,

We've registered your query, and our team will get back to you soon.

Regards,
Pranav

tired emberBOT
#

Hey! You shouldn't need the double mustache braces around the query data
reference if you're already in a JS context. Please provide the following to
help us debug this issue:

  • What version of Appsmith are you on?
  • Can you provide a loom.com recording and walk us through your current
    implementation? I'd like to take a closer look.
ocean lily
#

I replicated the instance and upgraded to v1.9.30 with the same results. I cannot provide the loom.com recording in a public forum. Another way?

tired emberBOT
ocean lily
#

Blindly upgrading to the latest version carries with it a risk of something breaking which we can't afford. If that is a must, then consider this closed.

ocean lily
#

Just FYI. Clean Iframe. Place mustache in srcDoc and the JSON shows correctly. Add a <script> tag before or after the mustache and the double quotes get automatically escaped with a backslash

tired emberBOT
#

@ocean lily You could spin up a test instance of the latest version
locally and import one of your apps to test the functionality before upgrading.

We only provide support for the latest versions of Appsmith. Please let us know
if you continue to encounter this issue after updating.

Thank you for your ongoing support and patience. We aim to provide you with
helpful assistance and hope we have addressed your question adequately.

Please take a moment to share your experience with our support team.
https://survey.frontapp.com/v2/09a400bf433bc9676d67/45e23be19b5bace6401621cf237daf52

tired emberBOT
#

As a workaround, you could use JSON.stringify() and replaceAll() to remove
the backslashes: var json = { "slider": {{JSON.stringify(Query1.data).replaceAll("\"","")}} };

ocean lily
#

That also removes the double quotes which where being escaped. They need to stay. Modifying what you provided with what would seem should only remove the backslash ... var json = { "slider":
{{JSON.stringify(Query1.data).replaceAll("","")}} }; does not work. Thank you for trying.

tired emberBOT
#

Ok. Our team is looking into this issue since we have been able to reproduce it
on the latest version of Appsmith. We'll let you know as soon as we get some
updates.

ocean lily
#

thank you

tired emberBOT
#

Hello!

Another suggestion:
var json = { "slider": {{JSON.stringify(Query1.data).replaceAll(/\\(?=")/g,"")}} };

This is shown to match what you're looking for. Please see the attached
screenshot.