import json mesages = [{"id": "1", "txt": "message 1", "start_date": "2014-02-09", "start_time": "16:20", "duration": "01:00"}] payload = json.dumps(mesages).encode("ascii") print(payload) print(type(payload)) # json can also loads bytes # but here the encoding is not explicit data = json.loads(payload) data2 = json.loads(payload.decode("ascii")) print(data2)
Output:b'[{"id": "1", "txt": "message 1", "start_date": "2014-02-09", "start_time": "16:20", "duration": "01:00"}]'
<class 'bytes'>
[{'id': '1', 'txt': 'message 1', 'start_date': '2014-02-09', 'start_time': '16:20', 'duration': '01:00'}]
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!