MySQL查询后,我用了json_encode将结果转换查询和我得到以下几点:转换JSON对象到JavaScript数组
[
{"id":"1","map_id":"1","description":"This is Athens","lat":"37.77994127700315","lng":"23.665237426757812","title":"Athens"},
{"id":"2","map_id":"1","description":"This is Rome","lat":"41.9100711","lng":"12.5359979","title":"Rome"}
]
我想将其转换为JavaScript数组,但得到只有价值。例如:
myArray = [
[1, 1, 'This is Athens', 37.77994127700315,23.665237426757812, 'Athens']
[2, 1, 'This is Rome', 41.9100711, 12.5359979, 'Rome']
]
我尝试了许多解决方案,我发现这里的,但我没有找到任何解决办法给我酷似myArray
数组。
[?你尝试过什么(http://mattgemmell.com/what -have-you-tried /) – 2014-11-03 13:30:15
你可以看看http://www.json.org/js.html – 2014-11-03 13:30:43
我试过解决方案在我发现这里http://stackoverflow.com/questions/20881213/converting-json-object-into-javascript-array和在一些其他问题。 – 2014-11-04 08:08:14