I need the serializer to produce an empty object. Normally I would just do
json_encode(new stdClass()) --> '{}'
but the symfony serializer does
$this->get('serializer')->serialize(new \stdClass(), 'json')) --> '[]'
I guess this is because the serializer first normalizes my data to an array, which is in this case empty.
Is there a way to get back json_encode default behaviour?