« Using Dropbox for plu… | Home | MBS Real Studio Plugi… »

JSON

I want to tell you the story I had the last days with JSON classes:
We started with a need to use JSON for talking to a server. We were happy to see JSONItem class in Real Studio, but we soon realized it has problems. First it did not preserve the text encoding. All the strings we got back had no text encoding set. Well we eventually worked around that, but later we discovered that the JSONItem class is very very slow. We really didn't want to wait 10 seconds for a big JSON to be parsed. So we checked for alternatives. As the client uses both Einhugur and MBS plugins, we have also JSONNode from Einhugur and JSONMBS from MBS Plugins available. A little speed test for parsing shows that the plugins do the 10 second job in less than 0.1 seconds. The Einhugur class was a little bit faster then mine, so we tried JSONNode. But it turns out that JSONNode doesn't return strings with text encodings, too.
So finally we came to JSONMBS class. Our class is a little bit lower level as you get nodes for arrays or dictionaries which you don't see that way with the other classes. But well, our JSONMBS class has decent speed and handles encodings better. Still we need to call the unescape function manually to removes escapes.
So finally we have a solution and our parse method implemented with 3 different classes. Good if we have to switch again later :-) The biggest plugin in space...
24 04 12 - 09:55