What is the best way to extract the information from an API response, for example when a stop report call is made, a response is obtained in this style:
"deviceId": 2,
"deviceName": "APV",
"distance": 0.0,
"averageSpeed": 0.0,
"maxSpeed": 0.0,
"spentFuel": 0.0,
"startOdometer": 3.856878395E7,
"endOdometer": 3.8570857E7,
"startTime": "2021-09-01T04: 00: 20.000 + 00: 00",
"endTime": "2021-09-01T11: 42: 54.000 + 00: 00",
"positionId": 31040101,
"latitude": -19.375893166666668,
"longitude": -97.16926716666667,
"address": "Calle",
"duration": 27754000,
"engineHours": 0
},
and I would like to convert that information into a pdf file with enriched format or, failing that, to an excel file, as well as it is obtained from the same traccar web platform. This with the intention of making a script that periodically sends reports of stops for example.
There are a heap of PHP or Python libraries out there that would be able to read JSON in and create a PDF or XLS from that.
Looks like a Python script is in your future. JSON -> CSV should be a very straightforward path. Doesn't even need a library, just print the fields to a string with commas and new lines.
What is the best way to extract the information from an API response, for example when a stop report call is made, a response is obtained in this style:
and I would like to convert that information into a pdf file with enriched format or, failing that, to an excel file, as well as it is obtained from the same traccar web platform. This with the intention of making a script that periodically sends reports of stops for example.