I have a JSON file that I'd like to "overwrite" with data from another JSON, but keep anything that isn't changed. Is there a way to do this out of the box for Azure DevOps pipeline releases? There is a Config transform plugin thingy for it named magic-chunks, but its syntax is really odd and doesn't work properly if I need to overwrite an array.
Destination (JSON that should be "overwritten")
{
"AppSettings": {
"AllowSwaggerRequests": false,
"Secret": "SomeStuff"
},
"Logging": {
"LogLevel": {
"Default": "Debug"
}
}
}
JSON that should be used and added on top of the previous one.
{
"AppSettings": {
"AllowSwaggerRequests": true,
"Secret": "Overwritten"
},
"TestProperty": "Hello World"
}
Expected result:
{
"AppSettings": {
"AllowSwaggerRequests": true,
"Secret": "Overwritten"
},
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"TestProperty": "Hello World"
}
The solution suggested by LoLance back in the day did not help sadly and I had given up on it altogether. Funnily enough, some time later I had managed to find an Azure DevOps extension / plugin called "File Patch Build and Release Tasks" (I am unable to find the link to it right now for some reason) which I used and which worked really. Its syntax was a bit unusual, but it did the job.