[Solved] how to format the text-file data to a specific standard JSON [closed]
import json input=””‘ABCD=123=Durham EFGH=456=Nottingham IJKL=789=Peterborough”’ print(json.dumps({‘data’: [dict(zip((‘name’, ‘id’, ‘place’), l.split(‘=’))) for l in input.split(‘\n’)]})) This outputs: {“data”: [{“name”: “ABCD”, “id”: “123”, “place”: “Durham”}, {“name”: “EFGH”, “id”: “456”, “place”: “Nottingham”}, {“name”: “IJKL”, “id”: “789”, “place”: “Peterborough”}]} 2 solved how to format the text-file data to a specific standard JSON [closed]