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

前端 未结 3 506
死守一世寂寞
死守一世寂寞 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:22

    You could replace Invoke-WebRequest with Invoke-RestMethod which auto-converts json response to a psobject so you can use:

    $response = Invoke-RestMethod -Uri "https://yadayada:8080/bla"
    $response.flag 
    

提交回复
热议问题