symfony - How to use php json_encode options in twig file with json_encode twig function -


i trying use twig json_encode function when this

    var packagedetails =  {{(packagedetails|json_encode)}}; 

and packagedetails array of array passed controller

it gives me error saying

    invalid property id  

because of " want use escape filter; how use it?

is because not wrapping output in quotes?

var variable = '{{{reference}}}'; 

update:

the actual answer solve question adding |raw tag per comments

var packagedetails =  {{(packagedetails|json_encode|raw)}}; 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -