json_encode必须将对象转换为数组

Currently I need to build an API to output as json format, and what I currently do (as example) is the following:

$array=array();
$array['firstname']="John";
$array['lastname']="Doe";
$array['cities']=array();
$array['cities']['name']=array("London","Brighton");
$array['cities']['population']=array("12000000","500000");
echo json_encode($array);

The output is:

{"firstname":"John","lastname":"Doe","cities":{"name":["London","Brighton"],"population":["12000000","500000"]}}

However I was told that this is incorrect, and the output needs to be

{"firstname":"John","lastname":"Doe","cities":[{"name":["London","Brighton"],"population":["12000000","500000"]}]}

(note the square brackets in the output). The reason was claimed that cities itself needs to be specified as an array since $array['cities'] is an array.

My questions are:

1) Is it custom to add square brackets in these cases to indicate it is an array?

2) How can I change my php code in order to have these square-brackets in the output?

help appreciated

Thanks Patrick

It's here

$array=array();
$array['firstname']="John";
$array['lastname']="Doe";
$array['cities']=array();
$array['cities'][]=array(
                        'name'=>array("London","Brighton"),
                        'population'=>array("12000000","500000")
                   );
echo json_encode($array);