public function toJson() { $ar['jsonrpc'] = $this->jsonrpc; if ($this->error) { $ar['error'] = $this->error; } else { $ar['result'] = $this->result; } $ar['id'] = $this->id; return Rpc::encode($ar); }