Convert to Json.
Convert to a Json string.
Parse from Json.
Parse from a Json string.
Create a new json request.
json rpc string
Json rpc method
import vibe.data.json; auto r1 = new JsonRpcRequest!int(); auto json = Json.emptyObject; json["foo"] = 42; r1.method = "foo"; r1.toString().should == `{"method":"foo","id":0,"jsonrpc":"2.0"}`; auto r2 = new JsonRpcRequest!int(); r2.method = "foo"; r2.params = json; r2.toString().should == `{"params":{"foo":42},"method":"foo","id":0,"jsonrpc":"2.0"}`; auto r3 = deserializeJson!(JsonRpcRequest!int)(r1.toString()); r3.id.should == r1.id; r3.params.should == r1.params; r3.method.should == r1.method; // string id: auto r10 = new JsonRpcRequest!string(); r10.method = "foo"; r10.id = "bar"; r10.toString().should == `{"method":"foo","id":"bar","jsonrpc":"2.0"}`;
A Json-Rpc request that use TId as id type.