import gpxpy
import json
import time

with open("track.gpx", "r") as f:
    gpx = gpxpy.parse(f)

points = []
for track in gpx.tracks:
    for segment in track.segments:
        for point in segment.points:
            ot_point = {
                "_type": "location",
                "tst": int(time.mktime(point.time.timetuple())),
                "lat": point.latitude,
                "lon": point.longitude,
                "alt": point.elevation,
                "acc": 10
            }
            points.append(ot_point)

with open("track.json", "w") as out:
    for p in points:
        out.write(json.dumps(p) + "\n")

