Use jms_serializer for encoding the response, if available. Fetch request data from request object instead of phpinput.