Closed rvencu closed 1 year ago
Found the problem, the ConvertTo-JSON command needs a -Depth 3
at minimum
Fixed:
"ResponseContentType" : "application/json"
in the route definition$Message | ConvertTo-Json -Depth 3
from the script where the message contains nested objects as described aboveGreat work!
Hi, I need to output some nested objects as a valid JSON. I have an AD attribute with multiple string values that I want to split into objects. This command:
is rendering
And I want to get something like this instead:
I tried to build an object
$quota
and nest it into the output, but I always get an array of strings that still need to be converted into objects.$quota = $_.accountNameHistory -split(' ') | ForEach-Object {Write-Output $_; } | Select-Object @{n='cluster';e={$_.split("|")[0]}}, @{n='gpus';e={$_.split("|")[1]}}, @{n='budget';e={$_.split("|")[2]}}
When I did this, the best I could obtain was still not what I expected: