data = data.decode("utf-8")
// For some weird reason (error?) the json library expects the keys to be delimited with double-quotes and not single-quotes.
// Not sure how our single quotes got here. Fix this better
data = data.replace("\"",""")
try:
// Convert the json str to a dictionary
data = json.loads(data)
// Add 1 because we found this ip again
After Change
data = json.loads(data)
// Add 1 because we found this ip again
data[str(saddr_as_obj)] += 1
data = json.dumps(data)
except (KeyError, TypeError) as e:
data[str(saddr_as_obj)] = 1
// Convet the dictionary to json
data = json.dumps(data)