New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoke-RestMethod
should have an -AsHashTable
switch
#19378
Comments
Invoke-RestMethod
should have an -AsHashTable
switchInvoke-RestMethod
should have a -AsHashTable
switch
Invoke-RestMethod
should have a -AsHashTable
switchInvoke-RestMethod
should have an -AsHashTable
switch
This would be useful. Somewhere - I can't remember where - I had to write code to convert the object returned back to hash table. |
Related #7880 |
What happens when the payload is NOT JSON? |
I guess a simple warning as:
and returning the content "as is", will be sufficient. In general, I don't see any issue when a potential
|
XML could be converted to a hashtable, but I suspect no one actually wants that. Perhaps in this case such a switch needs to be more explicit like |
Please either mark this issue with something like Resolution-Declined or put it on a kind of wishlist "Issue we would like to prioritize, but we can't commit we will get to it yet" |
I'm good with this. Just ran into this and while I can just pipe the result into ConvertFrom-JSON -AsHashTable, would be clean to do all upfront. Is there a performance or data hit if you use it when you don't need to? (like it there aren't duplicate keys with different spellings?) |
Summary of the new feature / enhancement
For the same reason as
ConvertFrom-Json
has an-AsHashTable
parameter (see: #3159),Invoke-RestMethod
should have an-AsHashTable
switch to convert to aHashTable
(or anOrderedHashTable
)See e.g.: powershell add key value to the json
Proposed technical implementation details (optional)
No response
The text was updated successfully, but these errors were encountered: