I have a json response from an API and I can't create an array from it with "json_decode" in PHP to iterate through this as an array. I always get "NULL", when I use "var_dump" to print out, what my "json_decode" returns. The response-header of this API response is "application/json", but I am not familiar with this json format.
The json response from the API looks like this:
[1,"Example name","307","7","Test","455",1458572100000]
[1,"Another example name","146","7","Test","455",1458571500000]
[1,"Test","304","7","Test","455",1458572280000]
[1,"Example name 3","163","7","Hello world","455",1458571080000]
This is the result/response of a single API request. Now, for example, I want to get the penultimate number (in this case everytime 455) of every line/object or, for example, the name (second value: "Example name", "Another example name", "Test" and so on). How can I do this with php and this json format? It would be nice, if I can get an array from this to iterate through.
It's a local realtime bus arrival API, but it's similar to/the same as content.tfl.gov.uk/…and I call this API with a simple http/get request using file_get_contents in PHP
"/interfaces/ura/instant_V1?returnList=stopID,stopPointName,LineID,DestinationText,estimatedTime,vehicleID&vehicleID=455")
{and a}from the beginning and end of the string that gets returned?