1

So I have a Pyramid view

@view_config(route_name='myview', renderer='myview.pug')
    def myview(self):
        myarray = [1, 2, "abc"]
        return {
            'myarray': myarray,
        }

I want to parse myarray variable into Javascript array in myview.pug but can't, seems Pyramid escape all double quotes into '

script.
    let myArray = #{myarray};

=> Unexpected token '&'

or

script.
    let myArray = '#{myarray}';

=> [1, 2, 'abc']

Thong Nguyen
  • 143
  • 3
  • 10

0 Answers0