I’m currently stuck on how to handle the data I’ve received back from an API call. First it’s stored in a list in the following format:
{u’lastActive’: ‘2019-01-23T13:50:03.000Z’, u’displayName’: ‘LV70’, u’type’: ‘vehicle’, u’photoUrl’: ‘http://localhost/NLTWeb/images/vehicles/Toyota.jpg’, u’name’: ‘LV70’, u’location’: {u’closestKnownLocation’: {u’name’: ‘760-E1-B2’, u’id’: 13}, u’duration’: 2544218, u’lastSeen’: ‘2019-01-23T13:49:51.000Z’, u’location’: {u’level’: {u’name’: ‘Ramp’, u’id’: 1}, u’isInMine’: True, u’position’: {u’coordinates’: [-65.59204146265984, 0.0005485117435425996], u’type’: ‘Point’}}, u’time’: ‘2019-01-23T13:07:33.000Z’}, u’id’: 10000055, u’vehicleType’: {u’name’: ‘Toyota’, u’id’: 5}}
I then converted it to a dictonary, and it’s now in the following format:
10000024 : {u’lastActive’: ‘1970-01-01T00:00:00.000Z’, u’displayName’: ‘U06’, u’type’: ‘vehicle’, u’photoUrl’: None, u’name’: ‘U06’, u’location’: {u’location’: None, u’time’: ‘2019-01-17T17:54:58.971Z’}, u’vehicleType’: {u’name’: ‘Transmixer’, u’id’: 7}}
I want to loop through either the list or the dictionary, map the values that end with a “:” to a field in a table, and insert the value after the “:”
My Googling is not getting me far, and Python is a whole new world to me. Any help is greatly appreciated.
Thanks,
Mikael