I want to retrieve json data from mysql and print it in HTML without any conversion using php framework---symfony5. But error occurs. "Cannot use object of type App\Entity\JsonData as array"
Controller -- retrieve function:
$data = $this->getDoctrine()->getRepository(JsonData::class)->findAll();
$cdata = [];
foreach ($data as $dd) {
array_push($cdata, json_decode($dd['json-content'], true));
}
return $this->render('index.html.twig', [
'cdata' => $cdata,
]);
I have tried json_decode but failed.