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: 
jbrave
Channel Surfer

Convert string to AA?

if I have a string that looks like this:

"{test:"west",best:"vest",apple:"fruit"}"

is there any easy way to convert to an Associative Array?

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
6 REPLIES 6
TheEndless
Channel Surfer

Re: Convert string to AA?

If aaString is "{test:"west",best:"vest",apple:"fruit"}"

Eval("aa = " + aaString)
print aa
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jbrave
Channel Surfer

Re: Convert string to AA?

ahhh, thank you.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
jbrave
Channel Surfer

Re: Convert string to AA?

Ok, this is embarrasing, but it turns out I didn't see the quotes, it isn't:

{tagname:"value",tagname1:"value"}

its {"tagname":"value","tagname1":"value"}

Any idea how to strip the quotes off the tagname so I can then get do the Eval ?

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
TheEndless
Channel Surfer

Re: Convert string to AA?

That's JSON. Take a look at the JSON parser that was discussed here awhile back and added to the rokudev library that GandK put together.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jbrave
Channel Surfer

Re: Convert string to AA?

Ah, ok, thanks. I think I might be able to force xml with a header. fingers crossed.

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
jbrave
Channel Surfer

Re: Convert string to AA?

well, the forced headers didn't work, but its simpleJSONParser to the rescue!

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos