How to parse JSON from the Invoke-WebRequest in PowerShell?

前端 未结 3 512
死守一世寂寞
死守一世寂寞 2020-12-03 02:53

When sending the GET request to the server, which uses self-signed certificate:

add-type @\"
    using System.Net;
    using System.Security.Cryptography.X50         


        
3条回答
  •  孤街浪徒
    2020-12-03 03:26

    If you have a need to use Invoke-WebRequest over Invoke-RestMethod you can convert it to an object by turning it into a string first

    $response = Invoke-WebRequest -Uri "https://yadayada:8080/bla"
    $jsonObj = ConvertFrom-Json $([String]::new($response.Content))
    

提交回复
热议问题