src/Statistic/Controller/StatisticController.php
public function cget()
    {
        $data = $this->statisticService->getAll();
        $data = $data->toObject();
        $data->timestamp = $data->timestamp->format(static::TIMESTAMP_FORMAT);
        $data->statistics = new stdClass;

        foreach ($data->collection as $datum) {
            $datum->timestamp = $datum->timestamp->format(static::TIMESTAMP_FORMAT);
            $alias = $datum->alias;
            unset($datum->alias);
            $data->statistics->{$alias} = $datum;
        }

        unset($data->collection);

        return new JsonResponse($data, Response::HTTP_OK, [
            'Content-Type' => 'application/json; charset=utf-8'
        ]);
    }
public function cget()
    {
        $data = $this->statisticService->getAll();
        $data = $data->toObject();
        $data->timestamp = $data->timestamp->format(static::TIMESTAMP_FORMAT);
        $data->statistics = new stdClass;

        foreach ($data->collection as $datum) {
            $datum->timestamp = $datum->timestamp->format(static::TIMESTAMP_FORMAT);
            $alias = $datum->alias;
            unset($datum->alias);
            $data->statistics->{$alias} = $datum;
        }

        unset($data->collection);

        return new JsonResponse($data, Response::HTTP_OK, [
            'Content-Type' => 'application/json; charset=utf-8'
        ]);
    }
Action

@Route(path="/statistics", methods={"GET"})
@Security("is_granted('BROWSE', 'statistic')")
@return \Symfony\Component\HttpFoundation\JsonResponse