Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
btpoole
Channel Surfer

Getting Value From json

Working with the following json data.


{
"current_observation": {
"image": {
"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
"title":"Weather Underground",
"link":"http://www.wunderground.com"
},
"display_location": {
"full":"MyCity, MyState",
"city":"MyCity",
"state":"MyState",
"state_name":MyState",
"country":"MyCountry",
"country_iso3166":"MyCountry",
"zip":"MyZipCode",
},
}


Attempting to get the value from the "full". With the following the only thing I get back are the element names but not the value.

full
city
state
state_name
country
country_iso3166
zip


for each display_location in result.current_observation.display_location
?display_location
end for

Have tried ?display_location.full but get syntax error. From what I see in the sdk example this should work. Can somebody point out the simple mistake I am making? Thanks
0 Kudos
3 REPLIES 3
hugetv
Visitor

Re: Getting Value From json

"btpoole" wrote:
Working with the following json data.


{
"current_observation": {
"image": {
"url":"http://icons.wxug.com/graphics/wu2/logo_130x80.png",
"title":"Weather Underground",
"link":"http://www.wunderground.com"
},
"display_location": {
"full":"MyCity, MyState",
"city":"MyCity",
"state":"MyState",
"state_name":MyState",
"country":"MyCountry",
"country_iso3166":"MyCountry",
"zip":"MyZipCode",
},
}


Attempting to get the value from the "full". With the following the only thing I get back are the element names but not the value.

full
city
state
state_name
country
country_iso3166
zip


for each display_location in result.current_observation.display_location
?display_location
end for

Have tried ?display_location.full but get syntax error. From what I see in the sdk example this should work. Can somebody point out the simple mistake I am making? Thanks


so I would use

videos = CreateObject("roArray", 100, true)
for each item in json.current_observation
this = {
title: item.title
city: item.city
state: item.state
}
videos.Push(this)
next
return videos
Our system http://www.rokumanager.com
0 Kudos
belltown
Roku Guru

Re: Getting Value From json

You should just be able to do:


?result.current_observation.display_location.full
0 Kudos
btpoole
Channel Surfer

Re: Getting Value From json

Thanks
?result.current_observation.display_location.full
worked.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.