Converts a Google Location JSON file into a CSV with Timestamp, Latitude, and Longitude.
import re | |
import json | |
import csv | |
JSON_data="C:/Users/JSON FILE PATH.txt" | |
CSV_file="C:/Users/CSV FILE PATH.csv" | |
with open(JSON_data) as f: | |
data = json.load(f) | |
csv_f=open(CSV_file, 'w') | |
for x in range(len(data["locations"])): | |
regex_Time=re.findall(".timestampMs.: .\d\d\d\d\d\d\d\d\d\d\d\d\d.", str(data["locations"][x])) | |
regex_Lat=re.findall(".latitude...: \d\d\d\d\d\d\d\d\d", str(data["locations"][x])) | |
regex_Long=re.findall(".longitude...: -\d\d\d\d\d\d\d\d\d", str(data["locations"][x])) | |
csv_f.write(regex_Time[0][16:-1] + "," + regex_Lat[0][14:] + "," + regex_Long[0][15:]+'\n') | |
csv_f.close | |
print('Done') |
This comment has been minimized.
This comment has been minimized.
It's this one, that doens't work: |
This comment has been minimized.
This comment has been minimized.
Ah! We found (my girlfriend and I), that there's a typo in l. 15: remove the dash before the
should be |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Hi! I just tried, but ran into this:
Is it a 'known issue' or did I likely just do something wrong?