簡體   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