Running this code gives "Notice: Undefined variable: container". Of course, because you did not abide by PHP's basic rules: a variable must be defined before it is used. There is no variable called "$container", so how would that usage example possibly work?
The documentation (https://jmsyst.com/bundles/JMSSerializerBundle) tells first how to install the bundle.
We have the first problem there, since there is no "AppKernel::registerBundles()" function in AppKernel.
Then, in usage, things get worse:
"The configured serializer is available as jms_serializer service:
$serializer = $container->get('jms_serializer'); $serializer->serialize($data, $format); $data = $serializer->deserialize($inputStr, $typeName, $format);"
Running this code gives "Notice: Undefined variable: container". Of course, because you did not abide by PHP's basic rules: a variable must be defined before it is used. There is no variable called "$container", so how would that usage example possibly work?