Fix encoding for http-post RPC to JSON