Created
December 6, 2024 09:33
-
-
Save strifel/52714c52215bd10b6473451fdad610b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = 'YOUR JSON HERE' | |
d = JSON.parse(data) | |
console.log("Hallo " + d['user']['name']) | |
console.log("Willkommen zur Year-in-Review Terminalausgabe!") | |
console.log("-----------------------------------------------") | |
console.log("Du bist dieses Jahr ganze " + Math.floor(d['distance']['total'] / 1000) + "km gefahren") | |
console.log("Das macht " + Math.floor(d['distance']['averagePerDay'] / 1000) + "km am Tag!") | |
console.log("-----------------------------------------------") | |
console.log("Ist " + d['operators']['topByDistance']['operator'] + " etwa dein Lieblingsbetreiber?") | |
console.log("Immerhin bist du " + Math.floor(d['operators']['topByDistance']['distance'] / 1000) + "km mit " + d['operators']['topByDistance']['operator'] + " gefahren.") | |
console.log("-----------------------------------------------") | |
console.log("Viel Zeit (fast " + Math.ceil(d['lines']['topByDuration']['duration'] / 60) + " Stunden) hast du auch im " + d['lines']['topByDuration']['line'] + " verbracht.") | |
console.log("-----------------------------------------------") | |
console.log("Deine längste Strecke war " + d['longestTrips']['distance']['train']['lineName'] + " von " + d['longestTrips']['distance']['train']['origin']['name'] + " nach " + d['longestTrips']['distance']['train']['destination']['name']) | |
console.log("Dein schnellster Zug " + d['fastestTrips']['train']['lineName'] + " von " + d['fastestTrips']['train']['origin']['name'] + " nach " + d['fastestTrips']['train']['destination']['name']) | |
console.log("Dein langsamster Zug " + d['slowestTrips']['train']['lineName'] + " von " + d['slowestTrips']['train']['origin']['name'] + " nach " + d['slowestTrips']['train']['destination']['name']) | |
console.log("Dein meist verspäteter Zug " + d['mostDelayedArrivals']['train']['lineName'] + " von " + d['mostDelayedArrivals']['train']['origin']['name'] + " nach " + d['mostDelayedArrivals']['train']['destination']['name']) | |
console.log("-----------------------------------------------") | |
if (d['lonelyStations'].length > 0) console.log("Ganz alleine warst du an " + d['lonelyStations'][0]['station']['name']) | |
console.log("Immer wieder (" + d['topDestinations'][0]['count'] + " mal) kamst du zurück nach " + d['topDestinations'][0]['station']['name']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment