JMS Serializer doesn't expose one property
You can serialize nulls as empty strings. Guess it help you a bit
$context = new SerializationContext();
$context->setSerializeNull(true);
$objectData = $serializer->serialize($object, 'json', $context);
For FOSRestBundle you can define it in settings
fos_rest:
view:
serialize_null: true
forgottenbas'es solution for FOSRestBundle
didn't work for me. I have found a solution here https://github.com/FriendsOfSymfony/FOSRestBundle/pull/480
Use serializer
section in your config, not view
:
fos_rest:
serializer:
serialize_null: true