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