Hi I have just had an odd problem this morning and I don’t know why my fix works.
$npmPackageDetails = & npm show $npmPackageName # Get the versions from the json response and select the latest one # No Idea why I had to pipe this through out-string to set server 2012R2 to work, but that is what it is there for. $latestVer = ($npmPackageDetails | Out-String | ConvertFrom-Json).'Dist-tags'.Latest
under Windows 10, I could just use $latestVer = ($npmPackageDetails | ConvertFrom-Json).’Dist-tags’.Latest
Anyone know why this might be? I looked at the $npmPackageDetails when piped to get-member and it shows as system.string for the type already. I get the following error without piping through out-string under server 2012R2: Invalid object passed in, ‘:’ or ‘}’ expected. (15): { name: ‘yarn’,
Cheers Paul
submitted by /u/toyonut
[link] [comments]
The post ConvertFrom-JSON not working without explicit pipe through out-string?? appeared first on How to Code .NET.