简体   繁体   中英

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. I'm using powershell runbook to retrieve the values from this json. But facing error. Can anyone please help me out regarding the same?

My 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

I executed below script in my environment and was able to successfully retrieve the expected content (from json format) .

$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:

在此处输入图像描述

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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