Extract value from JSON

前端 未结 2 1798
天涯浪人
天涯浪人 2021-01-05 17:19

I am trying to use PowerShell to extract value from JSON object, I have the following JSON:

{
    \"$schema\": \"http://schema.management.azure.com/schemas/2         


        
2条回答
  •  长发绾君心
    2021-01-05 18:14

    Use the Get-Content cmdlet to read the file, convert it using the ConvertFrom-Json cmdlet and just access the property you want:

    $yourVariable = (Get-Content 'yourJsonFilePath.json' | ConvertFrom-Json).parameters.clusterStorageAccountName.value
    

提交回复
热议问题