Remove backslash(\) from api response

Hi,

I am getting json data from rest api response and it looks like :-

{“message”: “{\”col1\”:\”abc\”,\”col2\”: \”xyz\”}”}

I need to populate this data in retool app in table i am using

[{{query.data.message}}]

It is not working i am guessing it is due to escape character backslash how to remove it?

Hi @Tanmoy

Yes, it looks like your response data is not properly formatted to work with Retools table out of the box. I have attached a screenshot of how you need to structure the data.

I think the response from your API call is not formatted as JSON but as a string value. Could you check your API documentation and your API request and check if you are using the right Content-Type?

You could try and parse out your response with regex. Something like query.data.replace(/\*/g,"") would help you get rid of the backslashes. But you would still need to transform the data so it works with the table component.

\

I dont think so format is wrong in query library it works fine without backslash but using the same in query response shows escape character backslash for double quotes.

Hey @Tanmoy!

Would you mind sending over a screenshot of where it's working properly? It may be that you can just use JSON.parse when passing the data to your table, but in your message it looks like is being used instead of " which causes problems when the JSON is parsed:

Using ":

Using :

Could just be a result of formatting on the forums :sweat_smile: but either way it'd be nice to see how you have it set up elsewhere.