A simple twig extension to provide json encode and decode filters and functions for Twig.
Requirements:
"require": {
"bearlikelion/twig-jsontools": "dev-master",
}
$twig = new \Twig\Environment(new \Twig\Loader\FilesystemLoader('Views'));
$twig->addExtension(new Bearlikelion\TwigJsonTools\Extension());
<html>
<body>
{{ json_decode(json.object) }}
</body>
</html>