Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse TFL api

Tags:

android

I am currently working on TFL based projects. And i want to parse the json file which is available in this link : http://countdown.api.tfl.gov.uk/interfaces/ura/instant_V1 So please help me out

like image 781
Maverick Avatar asked Jul 10 '26 18:07

Maverick


1 Answers

This API is not standard JSON as written in the TFL API documentation. It us actually best parsed as CSV but watch out because I have found out that some responses are inconsistent where the first line might have 6 strings while the second might have 5 with the missing field not identified as an empty string but simply omitted. This way parsing with a CSV parser will lead to errors since you might never know what is omitted.

I have also searched for the solution and the best I could find was another API that gives standard JSON but only returns bus stop countdown via a stopCode request.

Use This Link To Access It. http://countdown.tfl.gov.uk/stopBoard/75288

Im suprised as to why TFL uses this api for their own apps but not implement the public api to return good JSon like this one.

like image 102
Sani Yusuf Avatar answered Jul 13 '26 08:07

Sani Yusuf