Sunday, 11 August 2013

Unable to decode json file in a controller

Unable to decode json file in a controller

I'm a new symfony user, and I'm actually trainning myself on it. Here is
my problem:
echo
$this->container->get('templating.helper.assets')->getUrl('bundles/tlfront/js/channels.json');
$channels =
json_decode($this->container->get('templating.helper.assets')->getUrl('bundles/tlfront/js/channels.json'));
var_dump($channels);
I would like to decode a JSON file in my controller, but here is what the
echo and vardump give me:
/Symfony/web/bundles/tlfront/js/channels.json ( the echo)
null (the var_dump)
It seems that the path to the file is correct but json_decode doesn't
work. Any ideas or advices ?

No comments:

Post a Comment