AnsweredAssumed Answered

Help with parsing JSON Array Information

Question asked by JeffTomb on Oct 4, 2017
Latest reply on Mar 3, 2018 by jbrown

I am learning to work with APIs and Json responses.  I have had luck, up to this point, however I have run into trouble trying to extract the data in the fcttext field. Best I can tell from my research, the items in the forecastday are sent in an array with values from 0-7.  I do not know how to access the information.  The JSON response is below:

 

"forecast":{

"txt_forecast": {

"date":"5:44 AM PDT",

"forecastday": [

{

"period":0,

"icon":"clear",

"icon_url":"http://icons.wxug.com/i/c/k/clear.gif",

"title":"Wednesday",

"fcttext":"Sunny. High 69F. Winds W at 10 to 15 mph.",

"fcttext_metric":"Abundant sunshine. High near 20C. WSW winds at 5 to 10 km/h, increasing to 15 to 30 km/h.",

"pop":"0"

}

,

{

"period":1,

"icon":"nt_clear",

"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",

"title":"Wednesday Night",

"fcttext":"Clear skies. Low 51F. Winds W at 10 to 15 mph.",

"fcttext_metric":"A clear sky. Low around 10C. Winds WSW at 15 to 25 km/h.",

"pop":"10"

}

,

{

"period":2,

"icon":"clear",

"icon_url":"http://icons.wxug.com/i/c/k/clear.gif",

"title":"Thursday",

"fcttext":"Sunny. High 71F. Winds WNW at 10 to 15 mph.",

"fcttext_metric":"Mainly sunny. High 22C. WNW winds at 5 to 10 km/h, increasing to 15 to 30 km/h.",

"pop":"10"

}

,

{

"period":3,

"icon":"nt_clear",

"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",

"title":"Thursday Night",

"fcttext":"Clear. Low 54F. Winds WSW at 5 to 10 mph.",

"fcttext_metric":"Clear skies. Low 12C. Winds SW at 10 to 15 km/h.",

"pop":"0"

}

,

{

"period":4,

"icon":"clear",

"icon_url":"http://icons.wxug.com/i/c/k/clear.gif",

"title":"Friday",

"fcttext":"Sunny skies. High near 75F. ENE winds shifting to W at 10 to 15 mph.",

"fcttext_metric":"Mainly sunny. High 24C. NE winds shifting to W at 15 to 25 km/h.",

"pop":"0"

}

,

{

"period":5,

"icon":"nt_clear",

"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",

"title":"Friday Night",

"fcttext":"Clear. Low 54F. Winds WSW at 5 to 10 mph.",

"fcttext_metric":"A mostly clear sky. Low 12C. Winds WSW at 10 to 15 km/h.",

"pop":"0"

}

,

{

"period":6,

"icon":"clear",

"icon_url":"http://icons.wxug.com/i/c/k/clear.gif",

"title":"Saturday",

"fcttext":"Sunny. High 73F. Winds W at 10 to 20 mph.",

"fcttext_metric":"Mainly sunny. High 23C. Winds W at 15 to 30 km/h.",

"pop":"0"

}

,

{

"period":7,

"icon":"nt_clear",

"icon_url":"http://icons.wxug.com/i/c/k/nt_clear.gif",

"title":"Saturday Night",

"fcttext":"Clear skies. Low around 55F. Winds W at 10 to 15 mph.",

"fcttext_metric":"Clear. Low 12C. Winds W at 15 to 25 km/h.",

"pop":"10"

}

Outcomes