master:\media library\item-name contains a JSON file. Get-Item gets the item itself but I am unable to extract the JSON content with ConvertFrom-Json.
In PowerShell outside of Sitecore Powershell Extensions, this code works as expected:
$data = Get-Content -Raw "C:\Users\me\data.json" | ConvertFrom-Json
foreach($item in $data){
$item.name
}
When I try to use ConvertFrom-Json in Sitecore Powershell Extensions, I get a "Invalid JSON primitive" error because it's getting the item itself rather than the JSON data I uploaded:
How can I get the JSON data itself out of the item to feed to ConvertFrom-Json?