help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] JSON Dumper/Parser


From: Robin Redeker
Subject: [Help-smalltalk] JSON Dumper/Parser
Date: Mon, 4 Jun 2007 19:19:17 +0200
User-agent: Mutt/1.5.11+cvs20060403

Hi!

I've written a JSON dumper and parser some time ago
and haven't got around finishing it up for more smooth
usage. As I'm currenlty quite busy with my studies
I probably wont get around fixing the remaining issues:

   -  Unicode handling is not implemented and not really taken
      care of, this means you can probably only send ascii JSON
      around.
      Unicode needs to be implemented and somehow taken care of
      before this implementation can be called a real JSON dumper/parser.

   -  Also the handling of the '\uXXXX' escaping in JSON needs some
      thought and implementation (I'm not very familiar with the code anymore
      atm.)

   -  Maybe also the datatypes for json objects and arrays could be made 
configurable
      somehow. It's currently limited to generating Dictionary and 
OrderedCollection
      from a JSON string.
      The dumping works for Dictionaries and SequenceableCollection.

   -  The dumping of floats is currently just done by: (self asFloat) 
printString
      I don't know whether that always gives a JSON compatible representation.
      I only remember that I was too lazy to write a float dumper back then.
      Someone should take a look at this or at least keep it in mind.

So, before the code gets lost I've attached it to this mail (json.st).

There are some comments in the code and I hope it's mostly understandable.

When I have more time for coding I'll probably fix the issues, but I don't see
that in the near future (~3-4 months).

If anyone is interested feel free to fix the issues (just drop a mail to the ML
if you have done so, so that I don't fix already fixed things :).

Here is a short example:

   ~/devel/smalltalk# gst
   GNU Smalltalk ready

   st> FileStream fileIn: 'json.st'!
   FileStream
   st> JSONDumper toJSON: 'fooo'!
   '"fooo"'
   st> JSONDumper fromJSON: '{"a":"b"}'!
   Dictionary new: 32 "<0x2ad8f4e93be0>"
   st> (JSONDumper fromJSON: '{"a":"b"}') at: 'a'!
   'b'


Greetings,
   Robin

Attachment: json.st
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]