So, I have my xml like shown below with Parameter 4 being an integer and the rest being string parameters. The problem is that XML doesn't allow me to put the integer value without quotes (it doesn't like that).
When I convert it to JSON, I want the integer value to come over without the quotes.
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="application" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="Parameter1" Value="test1" />
<Parameter Name="parameter2" Value="test2" />
<Parameter Name="parameter3" Value="test3" />
<Parameter Name="parameter4" Value="42" />
</Parameters>
</Application>
I have a nested hash table (Thanks @mklement0 for assisting me with that)
$hash = [ordered] @{}
$appParametersXml.Application.Parameters.ChildNodes | % {
$hash[$_.Name] = @{ value = $_.Value }
}
# Wrap the hashtable in a top-level hashtable and convert to JSON.
[ordered] @{
'$schema' = 'https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#'
contentVersion ='1.0.0.0'
parameters = $hash
} | ConvertTo-Json |Out-File $parameterJsonFile
The output in the JSON file is correct, however, the last value (42) is also coming over within quotes. Is there a way to specify that one specific value is an integer?
Thank you in advance for your help :)
ConvertTo-Json