0
k ="[{\"id\": 1, \"latitude\": \"52.511467\", \"longitude\": \"13.447179\", \"bearing\": \"0.000000\", \"speed\": \"0.000000\", \"device_status\": 0, \"timestamp\": \"2013-08-18 00:00:00\"}, {\"id\": 3, \"latitude\": \"53.511467\", \"longitude\": \"14.447179\", \"bearing\": \"1.000000\", \"speed\": \"1.000000\", \"device_status\": 2, \"timestamp\": \"2013-08-18 00:00:00\"}, {\"id\": 4, \"latitude\": \"54.511467\", \"longitude\": \"15.447179\", \"bearing\": \"1.000000\", \"speed\": \"1.000000\", \"device_status\": 2, \"timestamp\": \"2013-08-18 00:00:00\"}, {\"id\": 5, \"latitude\": \"33.511467\", \"longitude\": \"72.447179\", \"bearing\": \"1.000000\", \"speed\": \"1.000000\", \"device_status\": 1, \"timestamp\": \"2013-08-18 00:00:00\"}]"

R = JSON.parse(k)

SyntaxError:予期しないトークン \

一方

m =JSON.parse("[{\"id\": 2, \"da\": \"1\"}]")

エラーなしで動作しています

4

2 に答える 2