New-PSUApiResponse -InputObject

2 votes

avatar

We need always serialize objects returned from APIs are arrays but we have no idea whether user want an array or a single object due to how the PS SDK works. If we added a new parameter to New-PSUApiResponse to control this, it would be helpful. Right now, users need to manually convert the object to JSON to get this to behave correctly.

# New way
New-PSUApiResponse -InputObject $MyStuff -AsSingleObject
# Old way 
New-PSUApiResponse -Body ($MyStuff | ConvertTo-Json -Depth 2)

Adam Driscoll
PowerShell Expert and Developer at Devolutions

All Comments (0)

Ends in 2 days