XML, JSON, or what?

Frank Millman frank at chagford.com
Thu Jun 8 02:52:10 EDT 2006


Hi all

I am writing a multi-user accounting/business application, which uses
sockets to communicate between server and client. The server contains
all the business logic. It has no direct knowledge of the client. I
have devised a simple message format to exchange information between
the two.

At first, I used XML as a message format. Then I read the article that
recommended not using XML for Python-to-Python, so I changed it to a
pickled collection of Python objects. It works just as well.

At present the client uses wxPython. One of my medium-term goals is to
write a web-based client. I don't think it will be easy to reproduce
all the functionality that I have at present, but I hope to get close.
I have not done any serious research yet, but I am pretty sure I will
use javascript on the client, to make it as universal as possible.

Ideally, the server should be able to handle a wxPython client or a web
client, without even knowing which one it is talking to. Obviously I
cannot use Pickle for this. So my question is, what is the ideal format
to use? I could go back to XML, or I could switch to JSON - I have read
a bit about it and it does not seem complicated. My messages are not
very large (maximum about 2k so far for a complex screen layout) so I
don't think performance will be an issue.

I would rather make a decision now, otherwise I will have a lot of
changes to make later on. Does anyone have any recommendations?

Thanks

Frank Millman




More information about the Python-list mailing list