Need to Replace single quote with double quotes in Ansible

I have a multiline variable “filedet” that contains string text having multiple single quotes.

I wish to replace the single quote to double quotes so that It can be acceptable for SQL query and below is what I tried.

filedet: “{{ ( filedet ) | replace(‘/’‘,’/‘/’') }}”
filedet: “{{ ( filedet ) | replace(‘’%c ‘%58’‘,’‘%c ‘%58’’%c ‘%58’') }}”

It does not help. Can you please suggest ?

Is your string intended to be used as a value inside an SQL query?
Or is your string going to be the entire query?
And which SQL dialect are we talking about?

I assume that "it does not help" means that you're getting an error.
It would have been nice to report that.
In any case, what you have now will result in a loop.

I you really must, you can replace the single quotes with double quotes by:

doubles: "{{ filedet | regex_replace(\"'\", '\"') }}"

Not sure why you're putting parentheses around the variable?

Dick