There are things that should be easy, but prove otherwise. Can you please explain how to pass a DataTable into a one-liner like “$dataTable | Select-Object $dataTable.Columns.ColumnName | ConvertTo-Json” and output a single JSON string from it?
See also Struggling to configure a PowerShell one-liner. Input and Output parameters