How do i remove "" from a query

i want to run a sql query using data i got from a JS query but the JS query is a string

for reference here is my SQL query
select
postcode_ref,
lat,
long
from
ops.postcodes
where
postcode_ref in ({{ query2.data}})

but my query2.data is like " 'NW11 XXX', 'SE1 XXX' "

how do i get rid of " ", I've tried {{ parseInt }} but it doesn't work

Thanks!!

Welcome to the community @jasper_nu

You could try split(',').map(val => val.trim())


or this
.replace(/'/g, '').split(',').map(val => val.trim())

and then using postcode_ref ANY({{query2.data}})
but it all kind of depends what you are trying to accomplish. Hope this helps

I would assume query2.data is an array. If so, the correct syntax would be:

select
  postcode_ref,
  lat,
  long
from
  ops.postcodes
where
  postcode_ref = ANY( {{ query2.data }} )