I have problem with exclusion of some KNP Paginator properties with JMS Serializer.
First, this is included in composer.json
...
\"jms/serializer-bundle\
Instead of serializing all the pagination object, try to serialize only the data and items, like this:
$result = array(
'data' => $pagination->getItems(),
'meta' => $pagination->getPaginationData());
return new Response(
$serializer->serialize(
$result,
'json',
SerializationContext::create()->setGroups(['Default'])
),
Response::HTTP_OK,
['Content-Type' => 'application/json',]
);