I wanted to save the contents of an array to a .json file.The array has some dictionaries in it. I tried
Set-Content -Path 'crl_urls.json' -Value $arrayval -Force
The JSON file has stored System.Collections.Hashtable
. It hasn't stored the values of the dictionaries.
So How do I do it?
To correctly save the content in a .json file you should first convert the array to the .json format. Try this:
ConvertTo-Json -InputObject $arrayval | Out-File -FilePath .\crl_urls.json