Like the other answer shows, you can use PowerShell hashtables as JSONs, however, PowerShell does have a way to work with JSONs.
First of all, even if there was a JSON datatype in Powershell, you would still be getting a syntax error for your JSON. This is what your JSON should look like:
$MyJsonVariable = @"
{
"MyList":{
"Item1":{
"Name":"AMD Ryzen 5 3600x",
"Type":"CPU",
"Price":"`$69.99",
"Where":"Amazon.com"
}
}
}
"@
Notice the commas and the colons before the curly braces.
Once we define this variable, we can convert it to an actual JSON with the ConvertFrom-JSON cmdlet:
$MyJsonVariable = $MyJsonVariable | ConvertFrom-JSON
Which would convert it to a JSON:
PS C:\> $MyJsonVariable.MyList
Item1
-----
@{Name=AMD Ryzen 5 3600x; Type=CPU; Price=$69.99; Where=Amazon.com}
PS C:\> $MyJsonVariable.MyList.Item1
Name Type Price Where
---- ---- ----- -----
AMD Ryzen 5 3600x CPU $69.99 Amazon.com
PS C:\> $MyJsonVariable.MyList.Item1.Where
Amazon.com
And to see the structure of it you can use the ConvertTo-JSON cmdlet:
PS C:\> $testjson | ConvertTo-Json
{
"MyList": {
"Item1": {
"Name": "AMD Ryzen 5 3600x",
"Type": "CPU",
"Price": "$69.99",
"Where": "Amazon.com"
}
}
}