-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Clean up JSON response #519
Copy link
Copy link
Closed
Labels
Milestone
Description
the response structure is currently:
"version": ...,
"status":...,
"status_message": ...,
"route_geometry": ...,
"route_instructions": [...],
"route_summary: {...},
"alternative_geometries": [...],
"alternative_instructions":[...],
"alternative_summaries":[...]
,"route_name":[...],
"alternative_names":[...],
"via_points":[],
"hint_data": ...,
"locations": [....],
"transactionId": ...
i think it would be cleaner to reorganize routes and alternate routes into a single array, with each element containing all the info for that particular route:
"version": ...,
"status":...,
"status_message": ...,
"routes":[
{
"name": ....,
"geometry" : ...
"instructions": [...],
"summary: {...},
},
{
"name": ....,
"geometry" : ...
"instructions": [...],
"summary: {...},
},
....
]
"via_points":[],
"hint_data": ...,
"locations": [....],
"transactionId": ...
if you did not request alternative routes, the array contains one element. if you did request alternatives, it could have 2 or more, or 1 if not alternative was found.
at the moment, info for a specific route is scattered across several arrays (which hopefully have the same length).
it also seems natural to move the route names into the route array elements, and drop the 'route_' prefix on the elements in the route array.
Reactions are currently unavailable