I have the following Json:
{
"variable1" : "variable2"
}
I won't know what the values for variable1
and variable2
are. I need to get them from the Json, presumably using two separate commands that use ConvertFrom-Json
in some way. They should be returned in plaintext format, not any PS Custom Object or anything like that.
You can export the keys and values as plain text using
Out-File
.Edit:
Credit to @Vivere, did not know
-AsHashTable
was introduced on PS Core. Supposing the test is performed on PS 5.1 here is how to get the same result. If the JSON has more depth check out the link provided by him on comment below.