I am using CJavaScript::jsonEncode($data) to convert a nested object into json data.
One of the nested objects is normally an associative array and so it converts into a JSON object, however if it is empty it converts into a JSON array. How can I force it to convert to an object in all cases?