ConvertFrom−Json : The term 'ConvertFrom−Json' is not recognized as the name of a cmdlet

53 Views Asked by At

I'm running this fairly easy PowerShell command:

az graph query -q "project id, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_"

So far so good:

{
  "count": 3,
  "data": [
    {
      "count_": 90,
      "location": "westeurope"
    },
    {
      "count_": 41,
      "location": "eastus"
    },
    {
      "count_": 11,
      "location": "germanywestcentral"
    }
  ],
  "skip_token": null,
  "total_records": 3
}

I want to format the JSON to something more readable so I will use the ConvertFrom-Json option:

az graph query -q "project id, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_" | ConvertFrom-Json

but this results in:

ConvertFrom−Json : The term 'ConvertFrom−Json' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:153
+ ...  summarize count() by location | top 3 by count_"  | ConvertFrom−Json
+                                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (ConvertFrom−Json:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Why and how to install ConvertFrom−Json?

shouldn't be there by default?

0

There are 0 best solutions below