[英]How to overcome WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 2?
Have provided my code and json format below.在下面提供了我的代码和 json 格式。 I'm using powershell runbook to retrieve the values from this json. But facing error.
我正在使用 powershell 运行手册从此 json 中检索值。但遇到错误。 Can anyone please help me out regarding the same?
任何人都可以帮我解决这个问题吗?
My 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"]
}
]}
My code:我的代码:
Get-AzStorageBlobContent -Destination $outPath -Container $containerName -Blob $huntingQueryFileName -Context $storageContext -Force
$newHuntingRules = Get-Content -Path "$outPath\$huntingQueryFileName" -Raw | ConvertFrom-Json
Facing the below error:面对以下错误:
WARNING: Resulting JSON is truncated as serialization has exceeded the set depth of 2警告:结果 JSON 被截断,因为序列化已超过设置的深度 2
I executed below script in my environment and was able to successfully retrieve the expected content (from json format) .我在我的环境中执行了以下脚本,并且能够成功检索到预期的内容(来自 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: Output:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.