deserialize - Twig Filter
Info
This feature is available in Contao 5.3.8 and later.
The deserialize
filter unserializes a string that contains serialized data into an array.
Info
Internally, this filter uses the Contao\StringUtil::deserialize()
method.
{# data will be a ["Foo", "Bar"] array #}
{% set data = 'a:2:{i:0;s:3:"Foo";i:1;s:3:"Bar";}'|deserialize %}
{# outputs the content of "foo" from the serialized array in "bar" #}
{{ (bar|deserialize).foo }}