Complete rewrite of JSON-RPC

A very different JSON-RPC interface based on type classes.
Yes, these tests are no longer relevant.