如何在Twig Symfony 4.3中解码JSON
如何解码Twig中的JSON数据这是我在控制器中的代码如何在Twig Symfony 4.3中解码JSON,json,symfony-4.3,Json,Symfony 4.3,如何解码Twig中的JSON数据这是我在控制器中的代码 public function testoutput($id) { $form = $this->getDoctrine() ->getRepository(ApplicationForm::class) ->findAll(); return $this->render('testoutput.html.twig', array('form' => $form));} 我的数据库看起来像这样 id |
public function testoutput($id) {
$form = $this->getDoctrine()
->getRepository(ApplicationForm::class)
->findAll();
return $this->render('testoutput.html.twig', array('form' => $form));}
我的数据库看起来像这样
id | jsonData | dateSigned
===|================================= |============
1 | {"fname":"Jan", "lname": "Jake"} | 10-09-2019
===|==================================|===========
2 | {"fname":"Mike", "lname": "Ham"} | 10-10-2019
===|==================================|===========
我想在我的细枝视图上显示此数据,但我遇到了此错误
未知的“json_解码”筛选器。你是说“json_编码”吗
我研究了这个错误,但似乎结果和代码已经过时,仍然使用Symfony 2大约6年前。这些文件夹和结构在Symfony 4.3中已经是新的。有什么新的解决方法吗
{% for data in form %}
{% set a = data.data_json | json_decode() %}
{% for json is a %}
{{ json['fname'] }}
{% endfor %}
{% endfor %}
您得到的确切错误是什么…未知的“json_解码”过滤器。你的意思是“json_encode”?可能重复请看这是否回答了你的问题?不工作了你得到的确切错误是什么…未知的“json_解码”过滤器。你的意思是“json_encode”?可能重复请看这是否回答了你的问题?不再工作了