Forum Discussion
No types for object data?
Hi, Ivan.
I'm not sure what method you're expecting to call, or from where, as the HTTPS response is simply plain text using JSON notation, and a plain text object has very few methods to begin with.
ConvertFrom-Json is simply taking that JSON text and transforming it into PowerShell [pscustomobject] object(s) to make subsequent scripting a little easier, but there's no magic going on that can convert it into an actual class complete with methods.
Typically, what happens where that kind of advanced functionality is required is that you will have a client-side PowerShell module that defines classes, which may or may not contains methods - but let's say they do. You will then invoke some commandlet that behind the scenes fetches the JSON via a HTTPS call and then locally instantiates a new instance(s) of that client-side class into which the JSON response is injected.
You can see from looking at your HTTPS response that this doesn't apply. The base "object" as well as the properties (depending on depth) are simple [pscustomobject] types where no meaningful methods exist, meaning the error is almost certainly accurate.
Cheers,
Lain