繁体   English   中英

如何克服 WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 2?

[英]How to overcome WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 2?

在下面提供了我的代码和 json 格式。 我正在使用 powershell 运行手册从此 json 中检索值。但遇到错误。 任何人都可以帮我解决这个问题吗?

我的json:

{"hunting": [
  {
    "displayName":"New Changes made to AWS IAM policy", 
    "description":"test",
    "query":"SecurityEvent | where EventID == \"4687\" | where CommandLine contains \"-noni -ep bypass $\"",
    "tactics":["Persistence","LateralMovement","Collection"]
  },{
    "displayName":"New Consent to Application discovery",
    "description":"test",
    "query":"SecurityEvent | where EventID == \"4688\" | where CommandLine contains \"-noni -ep bypass $\"",
    "tactics":["Persistence","LateralMovement"]
   }
]}

我的代码:

Get-AzStorageBlobContent -Destination $outPath -Container $containerName -Blob $huntingQueryFileName  -Context $storageContext -Force

$newHuntingRules = Get-Content -Path "$outPath\$huntingQueryFileName" -Raw | ConvertFrom-Json  

面对以下错误:

警告:结果 JSON 被截断,因为序列化已超过设置的深度 2

我在我的环境中执行了以下脚本,并且能够成功检索到预期的内容(来自 json 格式)

$path = "C:\temp"
$context = New-AzStorageContext -StorageAccountName "jahnavistorage" -StorageAccountKey "<storageaccountkey>=="
Get-AzStorageBlobContent -Container "<containerName>" -Blob "myjson.json" -Destination $path -context $context
Get-ChildItem -path $path
Get-Content -Raw $path\myjson.json | ConvertFrom-Json

Output:

在此处输入图像描述

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM