import json
from collections import namedtuple
input_json = '''
{
"ok": true,
"events": [
[
"GuardOn-1486253766",
1486253766,
"GuardOn",
43.871066,
56.166916,
null,
{
"reason": "fob",
"fob_number": 1
},
false
]
]
}
'''
input_data = json.loads(input_json)
Event = namedtuple(
"Event",
("id", "time", "event_type", "longitude",
"latitude", "duration", "data", "is_alarm")
)
events = input_data.get("events")
for event in events:
event_data = Event(*event)
print(event_data.time)
print(event_data.event_type)