data = {
"jsonrpc": "2.0",
"method": "map.create",
"params": {
"name": "Hosts",
"width": 500,
"height": 500,
"grid_show": 0,
"label_type_host": 0,
"label_type": 0,
"selements": [
{
"elementid": "10327",
"selementid": "1",
"elementtype": 0,
"iconid_off": "108",
"label": "server-1",
"x":200,
"y":85,
},
{
"elementid": "10084",
"selementid": "2",
"elementtype": 0,
"iconid_off": "108",
"label": "server-2",
"x":400,
"y":70,
},
# <= как добавить сюда элементы? :)
],
"links": [
{
"selementid1": "1",
"selementid2": "2"
}
]
},
"auth": "asdasdasdasdasd",
"id": 1
}
data = {
"jsonrpc": "2.0",
"method": "map.create",
"params": {
"name": "Hosts",
"width": 500,
"height": 500,
"grid_show": 0,
"label_type_host": 0,
"label_type": 0,
"selements": [
{
"elementid": "10327",
"selementid": "1",
"elementtype": 0,
"iconid_off": "108",
"label": "server-1",
"x":200,
"y":85,
},
{
"elementid": "10084",
"selementid": "2",
"elementtype": 0,
"iconid_off": "108",
"label": "server-2",
"x":400,
"y":70,
},
# <= как добавить сюда элементы? :)
],
"links": [
{
"selementid1": "1",
"selementid2": "2"
}
]
},
"auth": "asdasdasdasdasd",
"id": 1
}
new_data = [ { "ha":1, "haha":2, "hahaha":3 },
"string",
42]
for item in new_data:
data["params"]["selements"].append(item)
print(data)