JSON API v2

Backport from websocket_jsonrpc