How to use UDGrid with data with multiple levels?

I’ve got a pretty good handle on using UDGrids when it comes to basic key/value things, but I’m curious of how best to handle data that has key/value pairs where the value is another key/value pair, for example.

I have a nested UD Grid, but its not really what I’m looking for. I’ve also manually expanded the inner properties out to the top level of the data structure, but this isn’t very good design, at least in my opinion, so I’m wondering if anyone has any examples of dealing with this kind of data. Thanks for any help or suggestions!

Hey man, do you have any example code you can share? Sometimes this helps give a better answer to your conundrum you are facing. Thanks

1 Like

hey there

yeah i can help you there. try expanding your nested data in custom select expressions. only works if its a simple array of values. if you have big nested objects, you have to get creative. i like to expand the values first and join them together by a comma and a space.

(i reread your post now - if you’re already doing this expanding technique, well - maybe some other folks might find it helpful)


$exampleArray = 1..5 | % {
        Name   = "test$_"
        Nested = @("some", "nested", "values")

$exampleArray | Select-Object Name, @{n='Nested';e={($_ | Select-Object -ExpandProperty Nested) -join ', '}}