I made a Json parser in VisualWorks for our product, and I used an OrderedDictionary, because I wanted to be able to parse json to a JsonObject, then emit a json string back that would be equivalent. With a Dictionary, the order would change, thus making the original and emitted json strings different. Maybe that's why an OrderedCollection was used.<div>
<br></div><div>Mike</div><div><br clear="all">Mike Hales<br>Engineering Manager<br>KnowledgeScape<br><a href="http://www.kscape.com">www.kscape.com</a><br>
<br><br><div class="gmail_quote">On Mon, Jan 11, 2010 at 5:02 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">2010/1/12 Levente Uzonyi <<a href="mailto:leves@elte.hu">leves@elte.hu</a>>:<br>
</div><div class="im">> On Tue, 12 Jan 2010, Igor Stasenko wrote:<br>
><br>
>> 2010/1/12 Mike Hales <<a href="mailto:mike.hales@kscape.com">mike.hales@kscape.com</a>>:<br>
>>>><br>
>>>><br>
>>>> Or use better DB - CouchDB ;)<br>
>>>><br>
>>> Igor, I noticed your CouchDB library on SqueakSource, but browsing from<br>
>>> the<br>
>>> web interface it looked like a fork of the JSON libraries and I couldn't<br>
>>> quite tell what was going on. What is the status of this? Is it done and<br>
>>> is<br>
>>> there a tutorial?<br>
>><br>
>> I forked the JSON library to not interfere with existing one.<br>
>> My main point of displeasure with original, is that JsonObject using a<br>
>> collection<br>
>> of key/value pairs , held in OrderedCollection,<br>
>> while in my implementation a JsonObject is a subclass of Dictionary,<br>
>> which makes accessing properties much faster.<br>
><br>
> Older versions (up to JSON-ul.15) used a Dictionary. OrderedCollection was a<br>
> bad idea performance-wise.<br>
><br>
</div>I'm not sure yet. It maybe better to use a dictionary ivar instead of<br>
subclassing a Dictionary.<br>
Because in some places i need to tell the difference between<br>
Dictionary and JsonObject<br>
because i want to be allow to serialize and deserialize arbitrary<br>
smalltalk objects as documents,<br>
including collections and dictionaries , of course.<br>
So, when deserializing, i need to determine somehow, what instance to<br>
create - a Dictionary or<br>
another JsonObject.<br>
<div><div></div><div class="h5"><br>
<br>
><br>
> Levente<br>
><br>
>><br>
>> Also, an original CouchDB package (<a href="http://www.squeaksource.com/CouchDB" target="_blank">http://www.squeaksource.com/CouchDB</a>)<br>
>> using a curl plugin for speaking with database.<br>
>> While my implementation using a sockets, provided by squeak, which allows<br>
>> me<br>
>> to read the data in streaming mode, so i could start parsing a json<br>
>> document, even<br>
>> if its not fully retrieved yet i.e.:<br>
>><br>
>> stream := (db streaming documentAt: '12345') readStream.<br>
>> json := Json readFrom: stream.<br>
>><br>
>>> Mike<br>
>><br>
>><br>
>> --<br>
>> Best regards,<br>
>> Igor Stasenko AKA sig.<br>
>><br>
>><br>
><br>
><br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</div></div></blockquote></div><br></div>