When I do json_encode
from this array:
array('aps' => array(
'alert' => array(
'param1'=>array('string'),
'param2'=>'string' )));
I'm getting this JSON object:
{
"aps" : {
"alert" : {
"param1" : {
"0" : "string"
},
"param2" : "string"
}
}
}
Instead of
{
"aps" : {
"alert" : {
"param1" :
["string"],
"param2" : "string"
}
}
}
It seems to work right when the param1
array is not a single item.
How could I fix it? The Json is created from a third party bundle, so I should format the array in PHP so that I could get the correct JSON on json_encode
(param1
as a list).