achiang / openmotion

1 stars 1 forks source link

should return a single json object #4

Closed knitzsche closed 10 years ago

knitzsche commented 10 years ago

Currently, the return looks like an array of json objects, which is not a single json object [1]. this makes it harder to parse.

I would expect a single json object that is surrounded by curly braces and uses key/value pairs, like for example this [2].

[1] [ {"dis":2.186949373372794e-9,"obj":{"city":"Barcelona","mode":"bike","loc":{"type":"Point","coordinates":[2.180042,41.397952]},"station_id":"1","name":"760 Gran Via Corts Catalanes","_id":"53bc52896a83e721d4a811ca"}},{"dis":0.00003561475630068572,"obj":{"city":"Barcelona","mode":"bike","loc":{"type":"Point","coordinates":[2.180319,41.399982]},"station_id":"24","name":"185 Marina","_id":"53bc52896a83e721d4a811e1"}},{"dis":0.00003950957443377744,"obj":{"city":"Barcelona","mode":"bike","loc":{"type":"Point","coordinates":[2.183023,41.398305]},"station_id":"426","name":"59 Carrer de Ribes","_id":"53bc52896a83e721d4a8136d"}},{"dis":0.00004107709494070067,"obj":{"city":"Barcelona","mode":"bike","loc":{"type":"Point","coordinates":[2.178784,41.395796]},"station_id":"387","name":"125 Nàpols","_id":"53bc52896a83e721d4a8134a"}},{"dis":0.0000428532145183047,"obj":{"city":"Barcelona","mode":"bike","loc":{"type":"Point","coordinates":[2.182802,41.396632]},"station_id":"119","name":"122 Ausiàs March","_id":"53bc52896a83e721d4a81240"}} ]

[2] http://glosbe.com/gapi/translate?from=eng&dest=spa&format=json&phrase=house&pretty=true

knitzsche commented 10 years ago

ok, so it is a valid json array. this issue may be bogus as you (Alex) pointed out :) http://json.org/