I have json file with lot of comments inside file. I want to replace only specific values and save the results by saving the structure and formatting in a json file.
For example in this part:
"blocks" : [
{
"block_name" : "PNS1",
"ip" : "192.168.1.142",
"dynamic_ports" : { "first" : 10000, "last" : 15000 },
"inherits" : "PNS",
"in" : [],
"out" : [
/* Отправка данных в другой коллектор */
{ "name" : "collector_data_out", "dest_port" : "collector_data_in", "dest_block" : "PNS2", "fifo" : true },
/* Отправка темперутры, давлений и тарировок в СВС */
{ "name" : "svs_ctrl_out", "dest_port" : "svs_ctrl_in", "dest_block" : "SELF,MFI1,MODEL", "fifo" : true },
/* Отправка данных для определения главного транзитора */
{ "name" : "another_transitor_out", "dest_port" : "another_transitor_in", "dest_block" : "PNS2", "fifo" : true }
]
},
All i want to replace is in blocks -> ip. So it must be like this:
"ip" : "127.0.0.1",
Here is the original json file: https://pastebin.com/Neumxy4p
How can i do this via python json?
idkey for everydictinblocks?