1

I'm running a GET Rest request using PowerShell Invoke-RestMethod command. When trying to run the same API on a browser, I'm getting a full JSON file with full content. But when running using PowerShell Invoke-RestMethod, some parameters are not full. Instead I see: System.Object[]. For Example:

"process":  {
                    "phases":  [
                                   "@{steps=System.Object[]; name=Agent job 1; refName=Job_1;

What I'm expecting to get is:

"process": {
        "phases": [
            {
                "steps": [
                    {
                        "environment": {},
                        "enabled": true,
                        "continueOnError": false,
                        "alwaysRun": false,

Does any one have an idea how to overcome this PowerShell limitation?

Thanks, Shai.

ShaiO
  • 153
  • 1
  • 10
  • 1
    Looks like it is related to the Depth parameter of the convertto/convertfrom json. Did you try using something like this ? (Invoke-WebRequest -UseBasicParsing -Uri 'xxxxx').Content | convertto-json -depth 10 – Brice Apr 06 '22 at 14:06
  • @Brice - Genius!!! Thanks a lot, didn't think it would be that simple. Adding "-depth 10" to the request did solve that. Thanks again Brice. – ShaiO Apr 06 '22 at 14:15

0 Answers0