Trying to work with Mapael Jquery plugin. Plugin need object to draw a map elements.
My PHP code return json encoded array of objects:
[{
"Aveiro":{
"latitude":40.6443,
"longitude":-8.6455,
"value":10,
"tooltip":{
"content":"test"
}
}
},{
"Lisbon":{
"latitude":38.7167,
"longitude":-9.1333,
"value":10,
"tooltip":{
"content":"test"
}
}
},{
"Entroncamento":{
"latitude":39.2333,
"longitude":-9.0833,
"value":10,
"tooltip":{
"content":"test"
}
}
}]
If I parse this array thru json.parse I will receive object with numeric keys, in my example [0]->[Aveiro],[1]->[Lisbon],[2]->[Entroncamento].
How it possible to have object with keys [Aveiro],[Lisbon],[Entroncamento] without array indexes?
If I return only one object - I receive object with named key and everything works just fine.
$array = (array) $yourObject;. That will give you associative array.