-
-
Save gzysk8/e47b71db697c400fd91d5c7ea231de4c to your computer and use it in GitHub Desktop.
This file contains 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
// Get just data under the value key on the consumed message | |
const vehicle_value = message.value.value; | |
// Flatten the nested JSON | |
const flattenedVehicle = { | |
vehicle_id: vehicle_value.vehicle_id, | |
location_latitude: vehicle_value.location.latitude, | |
location_longitude: vehicle_value.location.longitude, | |
ts: Date.now(), | |
destination_latitude: vehicle_value.destination.latitude, | |
destination_longitude: vehicle_value.destination.longitude, | |
distanceRemaining: vehicle_value.distanceRemaining, | |
ETA: vehicle_value.ETA | |
}; | |
return flattenedVehicle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment