public function consultarValoresJSONAction() { $valorDao = new ValoresDao($this->getDoctrine()); $valorT = $valorDao->getValores(); $numfilas = count($valorT); $uni = new Valores(); $i = 0; foreach ($valorT as $uni) { $rows[$i]['id'] = $uni->getIdvalores(); $rows[$i]['cell'] = array($uni->getIdvalores(), $uni->getValdescripcion()); $i++; } $datos = json_encode($rows); $jsonresponse = '{ "page":"1", "total":"1", "records":"' . $numfilas . '", "rows":' . $datos . '}'; $response = new Response($jsonresponse); return $response; }