Im trying to serialize an object and skipping null value this is the object i try to serialize:
{
key1: null
key2: null
key3: {
keyA: null
keyB: 'value'
}
key4: 'value'
}
if i use the following method :
$object = self::getInstance()->serialize($object, "json", ['skip_null_values' => true]);
the object is succesfully serialized but it only remove the null key of the first level and not the one from the key3 object.
{
key3: {
keyA: null
keyB: 'value'
}
key4: 'value'
}
Is there any way to achieve this using the Symfony Serializer Component ?