Last active
August 29, 2015 14:01
-
-
Save trondhindenes/ac5b77b22fe422cb8885 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#A hashtable converted into a json string can be converted back to hashtable like so: | |
#Create a hashtable, convert to json | |
$hash = @{"Name1"="Value";"Name2"="Value2"} | |
$json = $hash | ConvertTo-Json | |
#Take the json string and convert it back: | |
$newobject = $json | ConvertFrom-Json | |
$newhash = @{} | |
foreach ($prop in $newobject.psobject.Properties) | |
{ | |
Write-verbose "added property $($prop.name) with value $($paramobject.($prop.name))" | |
$newhash.Add($prop.name,$newobject.($prop.name)) | |
} | |
$newhash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment