1) $Getjsonfilecontent = Get-Content "C:\Scripts\CreateADF-Datasets\BUSI_RULE_BUILD_LOCATION_CODES_Source_Def.json" -Raw | ConvertFrom-Json
2) Append some key pair values to the json file
3) $Getjsonfilecontent | ConvertTo-Json -Depth 100 | % { [System.Text.RegularExpressions.Regex]::Unescape($_) } | set-content $Updatedleafjsonpath (Updatedleafjsonpath is a copy of base file 'Getjsonfilecontent')
when i do this, am seeing some format is messed from "$Updatedleafjsonpath" as shown below. All of the "\" are missing and "\n" is also messed in my output. Note: There is another section in same json file that is udpated with key pair values as part of step2, but this sections is not udpated and should remain as is before and after conversion. Any help on this is really appreciated.
Input: same output is expected.
"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')]"
}
}
What i got after conversion:
"typeProperties": {
"format": {
"type": "TextFormat",
"columnDelimiter": "|",
"rowDelimiter": "
",
"quoteChar": """,
"nullValue": """",
"encodingName": null,
"treatEmptyAsNull": true,
"skipLineCount": 0,
"firstRowAsHeader": false
},
"fileName": "[parameters('Veh_Obj_properties_typeProperties_fileName')]",
"folderPath": "[parameters('Veh_Obj_properties_typeProperties_folderPath')]"
}