The json_encode filter returns the JSON representation of a value:
{{ data|json_encode() }}
Note
Internally, Twig uses the PHP json_encode function.
join
keys
Enter search terms or a module, class or function name.