To create an empty JSON object I do usually use:
json_encode((object) null);
casting null to an object works, but is there any other prefer
json_encode($array, JSON_FORCE_OBJECT) will do it too. see https://www.php.net/manual/en/function.json-encode.php
json_encode($array, JSON_FORCE_OBJECT)