My python function:
def somefunction(self):
x1 = ['reduced','fully automatic','years']
return x1
In Flask app.py file
keyword = somefunction()
JavaScript in html:
<script>
var javaword = '{{ keyword }}';
somefunction {
alert(typeof(javaword));
alert(javaword);
}
----------
Output -
String
['reduced', 'fully automatic', 'years']
I want the output as
Object
['reduced','fully automatic','years']
Solved
I figured it out and changed the following
var javaword =JSON.parse('{{ keyword|tojson }}');