print_r in twig symfony

{{ my_variable | json_encode(constant('JSON_PRETTY_PRINT')) }}
Shadow