I have a JSON master config file whose value may be overwritten by a specific account's config file (also in JSON).
master file
{
"section1Configs": {
"setting01": true,
"setting02": true,
"setting03": false
},
section2Configs: {
"setting01": true,
"setting02": true,
"setting03": false
},
section3Configs: {
"setting01": true,
"setting02": true,
"setting03": false
},
section4Configs: {
"setting01": true,
"setting02": true,
"setting03": false
}
}
config file
{
"section1Configs": {
"setting01": true,
"setting02": true,
"setting03": true
},
section2Configs: {
"setting01": false,
"setting02": true,
"setting03": false
},
section3Configs: {
"setting01": true,
"setting02": false,
"setting03": false
},
section4Configs: {
"setting01": true,
"setting02": true,
"setting03": false
}
}
Note that they are identical except certain values (section01Config.setting03
, section02Config.setting01
, and section03Config.setting02
) are different. Note also that the entire section4Configs
block is the same in both files.
The ones that are the same are not needed since the application loads both and overwrites the master file with the ones that are different in the account config.
What I would like to do is have a script that iterates through a directory of such account files and deletes the entry in each file that are the same key and value as the master file. From this example I would end up with a file like this:
{
section1Configs: {
setting03: true
},
section2Configs: {
setting01: false
},
section3Configs: {
setting02: false
}
}