Passing an array of Strings from Groovy to Javascript -


i building array of strings in groovy code , want pass array javascript script contained in code. however, groovy doesn't put strings in array quotes javascript expects. i'm passing array using gstrings:

var strains = ${strainnames}; 

javascript evaluates this:

var strains = [pseudomonas_aeruginosa_d421, pseudomonas_aeruginosa_oc2e, pseudomonas_aeruginosa_ea0a, pseudomonas_aeruginosa_0812]; 

is there way add quotes each element or have add them in groovy code?

you change:

var strains = ${strainnames}; 

to

var strains = ${strainnames.inspect()}; 

Comments