JSON-RPC Server for Python

Introduction

I've built a JSON-RPC server module for Python, called SimpleJSONRPCServer.py.

It's derived from the SimpleXMLRPCServer module from Python 2.4, and subclasses the XML-RPC classes, overriding only what is necessary to create a JSON-compatible version.

The interface is virtually identical to the classes in SimpleXMLRPCServer, except that 'XML' is changed to 'JSON'. For example, the module has a class called CGIJSONRPCRequestHandler instead of CGIXMLRPCRequestHandler, and SimpleJSONRPCServer instead of SimpleXMLRPCServer, etc.

Demonstration

Below are two files which demonstrate this JSON-RPC framework running in a CGI environment:

Download

Here again are all files involved in the demo:

License

I've modelled SimpleJSONRPCServer heavily from the original SimpleXMLRPCServer python library module. To avoid complications, I release it under the same Python license.