By default php json_encode() returns "[]" empty brackets for empty array. Also, it's possible to change to return "{}" brackets:
<?php
$result = array();
$json = json_encode($result, JSON_FORCE_OBJECT);
print($json);
The thing is need to fix web services to return null instead of empty brackets if array if empty. Is there any easy and standard way?
ifcondition doesn't seem easy enough for you?