从JSON转换不返回记录

从JSON转换不返回记录,json,powershell,Json,Powershell,我正在尝试解析以下JSON: StatusCode : 0 StatusDescription : Content : {123, 10, 32, 32...} RawContent : Content-Length: 10276747 Content-Type: application/octet-stream {

我正在尝试解析以下JSON:

StatusCode        : 0
StatusDescription : 
Content           : {123, 10, 32, 32...}
RawContent        : Content-Length: 10276747
                    Content-Type: application/octet-stream

                    {
                        "764411904": {
                            "abbrName": "SF",
                            "awayLosses": 1,
                            "awayTies": 0,
                            "awayWins": 0,
                            "calen...
Headers           : {[Content-Length, 10276747], [Content-Type, application/octet-stream]}
RawContentLength  : 10276747
但是,当我从Json转换时,我不会返回任何记录。以下是我的脚本:

$request = 'C:\Users\mcmon\Desktop\Projects\Madden Exports\teams-42e.json'
Invoke-WebRequest $request | ConvertFrom-Json | select abbrName

是的。。。这是为了疯狂的出口

正如@mjsqu所提到的,您需要使用
Get Content
而不是
Invoke WebRequest
。使用
-raw
参数将json作为字符串而不是字符串数组导入

$filePath= 'C:\Users\mcmon\Desktop\Projects\Madden Exports\teams-42e.json'
Get-Content $filePath -raw | ConvertFrom-Json

对文件运行
Invoke-WebRequest
似乎是这里的问题,请尝试在其工作的位置使用
Get-Content
。。。虽然我还没有得到选择。这是JSON的形成方式吗?您需要以某种方式访问子属性,尽管如果不查看原始JSON,很难确切地说出如何访问。可能需要类似于
(Get Content$filePath-raw | ConvertFrom Json).abbrName
,但在原始对象和abbrName之间可能还需要一些子属性。