title: Working with Powershell invoke-restmethod and json response
body: <p>VERY newbie here with Powershell and JSON so may need a little extra help.  Not a coder, fyi.</p>
  
  <p>I'm working with Dell's API to retrieve warranty information on machines.  I'd like to do it in Powershell if possible.</p>
  
  <p>Here's my code so far -</p>
  
  <pre><code>$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
  $headers.Add("apikey", 'mykey')
  $response = Invoke-RestMethod https://sandbox.api.dell.com/support/assetinfo/v4/getassetwarranty/servicecode -Headers $headers -contenttype 'application/json'
  </code></pre>
  
  <p>If I look at <code>$response</code>, here is the output -</p>
  
  <pre><code>AssetWarrantyResponse : {@{AssetHeaderData=; ProductHeaderData=; AssetEntitlementData=System.Object[]}}
  InvalidFormatAssets   : @{BadAssets=System.Object[]}
  InvalidBILAssets      : @{BadAssets=System.Object[]}
  ExcessTags            : @{BadAssets=System.Object[]}
  AdditionalInformation :
  </code></pre>
  
  <p>Did some digging and found if I use the below code, I can start seeing actual data -</p>
  
  <pre><code>$response.AssetWarrantyResponse|fl
  
  AssetHeaderData      : @{BUID=11; ServiceTag=....
  ProductHeaderData    : @{SystemDescription=Op....
  AssetEntitlementData : {@{StartDate=2017-11-2....
  </code></pre>
  
  <p>I see there is a command for convertfrom-json.  Looks like this will take the response and make it a little easier to work with in Powershell.  But I can't for the life of me make this work.  I'm trying to pull out a few pieces of data from the <code>AssetHeaderData</code> and <code>AssetEntitlementData</code> above.  I'm sure I could do some regex's, but if there's an easier way, I'm all for it!</p>
  
  <p>Any help is appreciated.  Thanks!</p>