Trader5050
Newbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2015
10:05 AM
LibRokuDev JSON & RegWrite/Read error
Hello again,
I'm having an odd problem.
I'm encoding an associativeArray into a JSON string using the librokudev GITHUB repository for storage into the registry. It looks like this:
Data = {
name: Cam
refresh: 1
url: http://somelongurl
title: Cam
randomize: YES
}
which is serialized into this string:
{"name":"Cam","refresh":"1","url":"http://somelongurl","title":"Cam","randomize":"YES"}
Later, I read this back out of the registry, parse it, and allow the user to edit it and save it again. The problem is that when it's re-saved, despite the "print" of the array LOOKING right, it now serialize's to this:
{"name":"String","refresh":"String","url":"String","title":"String","randomize":"String"}
Something weird is happening when data that looks just fine is re-encoded using the rdSerialize() function of librokudev. (using "JSON" option) The only thing I'm doing to the associative array before saving is calling "rdJSONBuilder(data)" (which simply calls rdSerialize(data,"JSON") )
Any ideas?
I'm having an odd problem.
I'm encoding an associativeArray into a JSON string using the librokudev GITHUB repository for storage into the registry. It looks like this:
Data = {
name: Cam
refresh: 1
url: http://somelongurl
title: Cam
randomize: YES
}
which is serialized into this string:
{"name":"Cam","refresh":"1","url":"http://somelongurl","title":"Cam","randomize":"YES"}
Later, I read this back out of the registry, parse it, and allow the user to edit it and save it again. The problem is that when it's re-saved, despite the "print" of the array LOOKING right, it now serialize's to this:
{"name":"String","refresh":"String","url":"String","title":"String","randomize":"String"}
Something weird is happening when data that looks just fine is re-encoded using the rdSerialize() function of librokudev. (using "JSON" option) The only thing I'm doing to the associative array before saving is calling "rdJSONBuilder(data)" (which simply calls rdSerialize(data,"JSON") )
Any ideas?
5 REPLIES 5

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2015
08:42 PM
Re: LibRokuDev JSON & RegWrite/Read error
Why are you using LibRokuDev for JSON parsing and formatting instead of the native ParseJson and FormatJson functions (http://sdkdocs.roku.com/display/sdkdoc/BrightScript+Language+Reference#BrightScriptLanguageReference...)? The first thing I'd do is switch to the native functions and see if that fixes the issue for you.
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
kbenson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2015
09:43 PM
Re: LibRokuDev JSON & RegWrite/Read error
That's interesting. I think I'll actually be doing some work on the Roku in the near future, so I'll try to take a look and see what's happening and try to fix it.
That said, if Roku now provides a native JSON serialization method, that's likely much better than the one implemented in librokudev, which is somewhat hacky.
If anyone has any requests, comments or suggestions for librokudev, please let me know.
That said, if Roku now provides a native JSON serialization method, that's likely much better than the one implemented in librokudev, which is somewhat hacky.
If anyone has any requests, comments or suggestions for librokudev, please let me know.
-- GandK Labs
Check out Reversi! in the channel store!
Check out Reversi! in the channel store!

TheEndless
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2015
09:50 PM
Re: LibRokuDev JSON & RegWrite/Read error
"kbenson" wrote:
That's interesting. I think I'll actually be doing some work on the Roku in the near future, so I'll try to take a look and see what's happening and try to fix it.
That said, if Roku now provides a native JSON serialization method, that's likely much better than the one implemented in librokudev, which is somewhat hacky.
If anyone has any requests, comments or suggestions for librokudev, please let me know.
Hey kbenson! Long time, no rearing of your head!
Unless I'm mistaken, I believe the librokudev JSON implementation was actually based on our collaborative Roku forum efforts several years ago (read: my appallingly bad regex, and your refinements), so I have decided to take offense to your "somewhat hacky" comment, even if it is accurate! 😉
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)
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
kbenson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2015
10:05 PM
Re: LibRokuDev JSON & RegWrite/Read error
"TheEndless" wrote:
Hey kbenson! Long time, no rearing of your head!
Yeah, I lurk every few months with a few specific searches to see if I've been called out or anyone's mentioned any of my pet projects, but generally that doesn't happen often.
...but Roku contacted me recently re: RAF, and the numbers look interesting enough that I'm intrigued. So maybe I'll be a bit more involved for a while. 🙂
"TheEndless" wrote:
Unless I'm mistaken, I believe the librokudev JSON implementation was actually based on our collaborative Roku forum efforts several years ago (read: my appallingly bad regex, and your refinements), so I have decided to take offense to your "somewhat hacky" comment, even if it is accurate! 😉
Well, it works most of the time, and was generally much faster than the tokenizing parser that was posted around the same time, so I'd say we all did pretty good. But it's still using regular expressions to parse JSON... so yeah, hacky. 😉
-- GandK Labs
Check out Reversi! in the channel store!
Check out Reversi! in the channel store!
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2015
07:17 PM
Re: LibRokuDev JSON & RegWrite/Read error
I think his beef was with "somewhat", not with "hacky" :twisted: