(Mar-10-2022, 01:07 PM)ilknurg Wrote: My json is coming me like :
lst = [ [{"Manufacturer": "VMware, Inc.", "Model": "VMware7,1", "Name": "DC01"}], [{"Index": "1", "IPAddress": ["192.168.1.240,fe80::350e:d28d:14a5:5cbb"]}], [{"Name": "DC01", "UserName": None}], ]So your data that i just copy before,then without
lst
copy into JSON Formatter.It will fix a couple of thing,then use
data.json
.import json from pprint import pprint with open('data.json', 'r') as myfile: data = json.load(myfile) pprint(data) print(data[0][0].get('Manufacturer'))
Output:[[{'Manufacturer': 'VMware, Inc.', 'Model': 'VMware7,1', 'Name': 'DC01'}],
[{'IPAddress': ['192.168.1.240,fe80::350e:d28d:14a5:5cbb'], 'Index': '1'}],
[{'Name': 'DC01', 'UserName': 'None'}]]
VMware, Inc.