simon-dt/gulp-twig

json_encode with constant

Opened this issue · 0 comments

When i try to use {{ dump(jsonData|json_encode(constant('JSON_UNESCAPED_SLASHES'))) }} to encode escaped html tags and special characters in my json-string but i'm always getting an error: TwigException: constant function does not exist and is not defined in the context

Also {% autoescape %} does not work: TwigException: Unable to parse 'autoescape'

Any suggestions in how to get twig to encode the json correctly?