Agregue nuevos pares de valores clave para json usando powershell
Estoy creando una plantilla de brazo para implementar conjuntos de datos en ADF, para eso necesito actualizar un archivo json existente con nuevos pares de valores clave basados en mi archivo de entrada. ¿Cómo agrego nuevos pares de valores clave al archivo json usando powershell? Cualquier ayuda en esto es realmente apreciada ..
Si estoy usando "Add-Member", se está actualizando con una nueva "clave" y "valor" para todas las propiedades en la estructura, como se muestra a continuación. Pero quiero que se agreguen una nueva clave y valor después de otro par de valores como lo he mostrado muy por debajo del código resaltado con "Necesito agregar esto"
{
"name": "VIN",
"type": "String"
"newkey1" : "newvalue1"
"newkey2" : "newvalue2"
},
{
"name": "MAKE",
"type": "String"
"newkey1" : "newvalue1"
"newkey2" : "newvalue2"
},
Mi código debería verse así: "Necesito agregar esto" son los pares de valores clave que tengo la intención de agregar en cada ciclo siempre que tenga entradas de otro archivo de texto.
{
"name": "[concat(parameters('factoryName'), '/Veh_Obj')]",
"type": "Microsoft.DataFactory/factories/datasets",
"apiVersion": "2018-06-01",
"properties": {
"linkedServiceName": {
"referenceName": "AzureDataLakeStore1",
"type": "LinkedServiceReference"
},
"annotations": [],
"type": "AzureDataLakeStoreFile",
"structure": [
{
"name": "VIN",
"type": "String"
},
{
"name": "MAKE",
"type": "String"
},
{
"Need to add this": "Need to add this",
"Need to add this": "Need to add this"
},
{
"Need to add this": "Need to add this",
"Need to add this": "Need to add this"
},
{
"Need to add this": "Need to add this",
"Need to add this": "Need to add this"
},
{
"Need to add this": "Need to add this",
"Need to add this": "Need to add this"
}
],
"typeProperties": {
"format": {
"type": "TextFormat",
"columnDelimiter": "|",
"rowDelimiter": "\n",
"quoteChar": "\"",
"nullValue": "\"\"",
"encodingName": null,
"treatEmptyAsNull": true,
"skipLineCount": 0,
"firstRowAsHeader": false
},
"fileName": "[parameters('Veh_Obj_properties_typeProperties_fileName')]",
"folderPath": "[parameters('Veh_Obj_properties_typeProperties_folderPath')]"
}
},
"dependsOn": [
"[concat(variables('factoryId'), '/linkedServices/AzureDataLakeStore1')]"
]
},