New-UDHTML is upsetting me

I could be doing this wrong but the powershell is doing what i want, just the UDGrid and html are not outputting what im feeding in.

So i have a json file im reading, moving to an array cause im updating data, such as a url name to a friendly version.

Name        : Yā’mon (Hadur)
Affiliation : Xi'An
Type        : SINGLE_STAR
Planets     : 4
Jumpoints   : 4
Satellites  : 0
urlname     : Hadur

This is an entry from my array and here is my command to output it to the grid.
$sys_array | Where-Object {$_.Name -ne $Null} | Select-Object @{Name = "Name"; Expression = {New-UDHtml -Markup "<a Href=""http://localhost/system/$($_.urlname)"">$($_.Name)"}}, @{Name="Affiliation"; Expression = {$_.Affiliation}}, @{Name="Type"; Expression = {$_.Type}}, @{Name="Planets"; Expression = {$_.Planets}}, @{Name="Jumpoints"; Expression = {$_.Jumpoints}}, @{Name="Satellites"; Expression = {$_.Satellites}} | Out-UDGridData

I have also tried below to skip any html output
$sys_array | Where-Object {$_.Name -ne $Null} | Out-UDGridData
However for some reason the Name column is printing _.name just fine, however the .urlname is the same as the $.name variable. but when I print the array it shows the array data like above.

So I know the array is correct, but when outputting it to the grid with or without the html is gives the wrong data for the URL.


image

Hello @Bacon terribly sorry to hear this is upsetting you…although I have never used this technique to get json to a grid, I believe the problem is…you need to convert it to a [pscustomobject] as shown in the examples in the code here:- https://poshud.com/New-UDGrid I believe this will then display all the values correctly in the grid. Peace :smiley: