I have this dictionary "properties " with a key livenessTests and in turn the livenessTests is a list of dictionaries. How do I add/append livenessTests to another dictionary json?
The resulting "json" directory should be something like
I am trying this :
But I am getting ,
so I am not getting the key 'properties' .
Can you tell me where I am wrong ?
Code:
properties = {
'livenessTests': [
{
'name':'http' + '_' + 'livenesstest',
'testObject':'/default.html'
},
{
'name':'https' + '_' + 'livenesstest',
'testObject':'/default.html'
}
]
Code:
json : {
"acg": {
"id": "1-7KLGU.G19717",
"name": "Akamai Internal-1-7KLGU - 1-7KLGU.G19717"
},
"asmappings": [],
"cidrMaps": [],
"properties": {"livenessTests" : [{<contents from list above>},
{<contents from list above>}
]
}
Code:
json['properties'] = []
for key in properties.keys():
print key
json['properties'].append(property[key])
Code:
"livenessTests": [
{
"name": "http_livenessTest",
"testObject": "/default.html"
},
{
"name": "https_livenessTest",
"testObject": "/default.html"
},
Can you tell me where I am wrong ?
Comment