3 ms·
I've never used Powershell. Is it possible for Powershell to output the object as JSON so that you can see what you can read from the object?
by aembleton 11y ago
I've never used Powershell.
Is it possible for Powershell to output the object as JSON so that you can see what you can read from the object?
- kuma4 11y agodir | ConvertTo-Json dir | ConvertTo-Html dir | ConvertTo-Xml dir | ConvertTo-Csv
- brudgers 11y agoIn the world of Powershell, reflection would be the way to go because then I still have an object. A rough analogy would be the window object in Javascript where I call `window.open(something)` directly. Serializing a value returned by a Powershell command to JSON eliminates being able to call `returned_value.some_method(something)` because converting it into JSON puts me in the world of text and parsing. At that point, I either know the name of the method I'm looking for or I don't. In the first case the conversion to JSON doesn't do me any good because I can just call the method directly using `object.method(value)`. In the second case, it doesn't do any good because I don't know the method I want. Reflection looks more like this: http://stackoverflow.com/questions/9952391/use-get-member-for-reflection http://stackoverflow.com/questions/9952391/use-get-member-fo...