First go at almost working JSON-RPC.