>>> import json
>>> from pprint import pprint
>>> json_example = open("json_example.json").read()
>>> pprint(json_example)
# Convert JSON strings to Dictionaries / Lists
>>> json_python = json.loads(json_example)
>>> int_name = json.python["ietf-interfaces:interface"]["name"]
>>> int_name
# Convert Dictionaries to JSON
>>> json.dumps(json_python)
# json_example.json
{
"ietf-interfaces:interface": {
"name": "GigabitEthernet2",
"description": "Wide Area Network",
"enabled": true,
"ietf-ip:ipv4": {
"address": [
{
"ip": "172.16.0.2",
"netmask": "255.255.255.0"
}
]
}
}
}