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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -