Encoding for Kraken json objects changed?

Hello, I’m parsing Kraken json objects in Rainmeter to have a list of streams for certain games directly on my desktop. A few days ago, the script broke. After investigating I noticed that the ordering of keys changed which caused the problem (I read in another topic that the order of keys isn’t guaranteed, which is a bit annoying, but since it doesn’t change too often I can live with it).

However the bigger problem is that since the ordering change I also seem to have encoding problems. Wheras before Korean letters would be displayed perfectly fine in my skin I now only get unicode codes (like \u041f\u0420\u041e etc). Any idea on how I can fix this?

This is the URL I pull with Rainmeter (json object gets saved to disc): https://api.twitch.tv/kraken/streams?game=League+of+Legends

This is the regex I use to extract the desired information I want to display in Rainmeter (right now I have it set so the Top 8 viewer streams are displayed):

RegExp="(?siU)(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",").*(?(?=.*"channel":).*"display_name":"(.*)",".*status":"(.*)","url":"(.*)",")

(The lookahead checks here are of course unnecessary for LoL, since there are always more than 8 streams, but I use it for other games aswell, eg Dwarf Fortress where there are not always 8 streams and using the regex without lookahead checks would break the entire thing).

Any help would be appreciated :slight_smile:

Update: I circumvented the problem by using xml list instead: http://api.justin.tv/api/stream/list.xml?category=gaming&meta_game=League%20of%20Legends

The xml list uses HTML entities instead of unicode codes. Rainmeter can auto-decode the HTML entities to restore Korean and other special chars, so my problem is solved now. Still wondering why it broke to begin with.

The point I attempted to make in the other topic is that since Kraken outputs JSON, we expect end users to parse it as JSON. Since unicode escape codes are valid JSON that resolves transparently in any JSON parser, we didn’t consider it a breaking change.

Assuming your Rainmeter skin uses lua, I’d recommend properly parsing the JSON instead of hacking together a regex that may or may not work.