I'm trying to perform some config transformations on JSON files using PowerShell. For this there's several input json files and a transform one (one for each environment).
Input sample (AzureStorage.json):
{ "$schema": "http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.LinkedService.json", "name": "AzureStorage", "properties": { "type": "AzureStorage", "typeProperties": { "connectionString": "My Connection String here" } } } Transform:
{ "$schema": "http://datafactories.schema.management.azure.com/vsschemas/V1/Microsoft.DataFactory.Config.json", "AzureStorage": [ { "name": "$.properties.typeProperties.connectionString", "value": "DefaultEndpointsProtocol=https;AccountName=mytestaccount;AccountKey=d;lasfjdalfdjfldjfdsfds;EndpointSuffix=core.windows.net" } ], "DataLakeStore": [ { "name": "$.properties.typeProperties.dataLakeStoreUri", "value": "https://mydatalake.azuredatalakestore.net/webhdfs/v1" } ] } What I need to do, is to load the transform file, then traverse it, finding the names of the input files I need to transform (in this example AzureStorage.json and DataLakeStore.json).
Next, I need to replace the properties accordingly. I'm trying to do it by loading the transform file into a variable using ConvertFrom-Json, but I not sure how to traverse it afterwards.