Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let dataToWrite = '';
- const fs = require('fs');
- const testData = require('./your/takeout/file.json')
- for (item in testData.locations){
- let lat = String(testData.locations[item].latitudeE7).substr(0, (String(testData.locations[item].latitudeE7).length - 7)) + '.' + String(testData.locations[item].latitudeE7).substr((String(testData.locations[item].latitudeE7).length - 7))
- let lng = String(testData.locations[item].longitudeE7).substr(0, (String(testData.locations[item].longitudeE7).length - 7)) + '.' + String(testData.locations[item].longitudeE7).substr((String(testData.locations[item].longitudeE7).length - 7))
- dataToWrite = dataToWrite + `${testData.locations[item].timestampMs},${lat},${lng}\n`
- }
- fs.writeFile('what-you-want-t0-call-it.csv', dataToWrite, 'utf8', function (err) {
- if (err) {
- console.log('Some error occured - file either not saved or corrupted file saved.');
- } else{
- console.log('it saved');
- }
- });
Add Comment
Please, Sign In to add comment