"renojim" wrote:
"kbenson" wrote:
Key names with spaces will be changed to have underscores, as BrightScript doesn't allow spaces in associative array key names.
That's not true. You can have key names with spaces, but you have to use AddReplace and Lookup to access the key. Example:x = CreateObject("roAssociativeArray")
x.AddReplace("this key has spaces","this is the value")
print x.Lookup("this key has spaces")
-JT
Actually, keys with spaces work just fine with the square bracket notation, too...
Example:
x = {}
x["this key has spaces"] = "this is the value"
print x["this key has spaces"]
For clarification for the OP, the problem kbenson was referring to was that the inline associative array syntax that the SimpleJSON parsers use doesn't allow for quoted key names, so spaces have to be replaced. The original JSON parser for BrightScript used a brute force method that did support spaces, but was extremely slow parsing. The SimpleJSON library uses RegEx to finesse the JSON into a format that is natively parsable by BrightScript, with a few tradeoffs.
If the API your using provides an XML format, the native BrightScript XML parser is infinitely faster than the community provided JSON parsers, so that would likely be a better option.
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)