title: I want to extract the data present in JSON file from a odata url but i am unable to extract the content using a loop
body: <p>Below is the JSON file which i am referring..</p>
  
  <pre><code>{
    "@odata.context": "https://ac.com/odata/$metadata#ModelVariableDataTypes(Id,ModelVariable,DoubleValues,ModelVariable(Id,Name,UnitOfMeasure,UnitOfMeasure(Name,Abbreviation)),DoubleValues(Id,Value,Timestamp,DataQuality,DataQuality(Id,Name)))",
    "@odata.count": 1,
    "value": [
      {
        "Id": 1928155,
        "ModelVariable": {
          "Id": 1929663,
          "Name": "AccCore_CPULoadProcess",
          "UnitOfMeasure": {
            "Name": "%",
            "Abbreviation": "%"
          }
        },
        "DoubleValues": [
          {
            "Id": 75865549,
            "Value": 0.0,
            "Timestamp": "2018-09-25T03:35:00Z",
            "DataQuality": {
              "Id": 1,
              "Name": "Good"
            }
          },
          {
            "Id": 75865729,
            "Value": 0.0,
            "Timestamp": "2018-09-25T03:40:00Z",
            "DataQuality": {
              "Id": 1,
              "Name": "Good"
            }
          },
          {
            "Id": 75865873,
            "Value": 0.0,
            "Timestamp": "2018-09-25T03:45:00Z",
            "DataQuality": {
              "Id": 1,
              "Name": "Good"
            }
          }
        ]
      }
    ]
  }
  </code></pre>
  
  <p>I want to extract the data present in JSON file from a odata url but i am unable to extract the content using a loop as in the JSON file the odata count is mentioned as 1(@odata.count": 1) so when i am trying to catch the entire data using a loop it is not working.</p>
  
  <p>I want to extract the data present in the array field of doublevalues and wanted to show the output of the top three values of CPU process.</p>
  
  <p>I am trying with the below code to extract the JSON data.</p>
  
  <pre><code>$path= "C:\Users\s.papolu\Desktop\mem.json"
  $data = Get-Content -Path 'C:\Users\S.Papolu\Desktop\mem.json' | ConvertFrom-Json 
  
  $maxCount = $data.'@odata.count'
  $maxCount
  
  @"
  for ($i = 0; $i -lt $maxCount; $i++)
  {
  $Name = $("{0:N1}" -f $data.value.ModelVariable.Name)
  $cpu = $("{$i`:N2}" -f $data.value.DoubleValues.Value)
  }
  
  write-host $Name,$cpu
  </code></pre>