gpt4 book ai didi

powershell - ConvertFrom-Json剂量物反序列化为对象

转载 作者:行者123 更新时间:2023-12-02 23:39:11 28 4
gpt4 key购买 nike

尝试发送api请求并遍历响应,但是似乎我的响应没有反序列化到对象。

这是我在invoke-Webrequest之后得到的响应:

{"isSuccess": true, "value": null, "error": 0, "error2": ""}

代替:
Value error error2                                          IsSuccess
----- ---- ------- ---------

这是使用im的invoke im:
$json = Invoke-WebRequest $RequestAPI-Method Post -Body $RequestBody -
ContentType 'application/json' | ConvertFrom-Json

没有发布API /正文,因为它们是内部的。这是PowerShell的问题吗?还是我收到错误的类型响应?我有点困惑。

如果需要更多信息,请告诉我,我将尝试添加。

最佳答案

您可能必须选择Content属性

$json = Invoke-WebRequest $RequestAPI-Method Post -Body $RequestBody -ContentType 'application/json' |
Select-Object -expand Content |
ConvertFrom-Json

关于powershell - ConvertFrom-Json剂量物反序列化为对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47051614/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com