I have an array $suggested_cities, here it is vardumped:
array(3) {
[15526]=>
string(9) "Alabaster"
[15137]=>
string(7) "Florala"
[37091]=>
string(8) "Saraland"
}
When I json encode this array:
echo json_encode(array($suggested_cities));
I get this output:
[{
"15526": "Alabaster",
"15137": "Florala",
"37091": "Saraland"
}]
But I need it to be:
[{
"15526": "Alabaster"
},
{
"15137": "Florala"
},
{
"37091": "Saraland"
}]
How can I do that? I assume it's a "duh" answer but I just can't figure it out.