I populated an array using the following:
forEach ($ip in $ipReturn.IPAddress) {
try {
$jsonObject = Invoke-RestMethod -Method Get -Uri "https://api.weatherchannel/forecast/daily?ip=$ip&days=2&units=I&key=$apiKey" -Headers $header
$jsonDataArray += $jsonObject
}
catch {
$errorTrap = $error[0]
Write-Host "Status Code:" $_.Exception
Write-Host "Status Description:" $_.Exception
}
}
I have the following data populated in an Array in PowerShell:
$jsonDataArray | foreach{Write-Host $_}
@{timezone=America/New_York; city_name=Azalea Park; lon=-81.3004; data=System.Object[]; state_code=FL; country_code=US; lat=28.5535}
I need the data located in each array piece. Particularly: data=System.Object.
I had thought to use the following structure:
$foreach (system.object['data'] in $jsonDataArray)
{
//pull and extract all data as string objects and populate those strings into a new array. Search each array string and pull data to create histogram.
}
I have looked through code. Does anyone have an idea how I can achieve this data extraction?