我使用带有Route anotation的RequestClass来调用Json-Client POST方法.现在,虽然参数的结构是这样的
public class GetTicketRequest: IReturn<JsonObject>
{
public string CartId {
get;
set;
}
public string PriceId {
get;
set;
}
}
Run Code Online (Sandbox Code Playgroud)
BackendAPI需要它们在json请求中的"data"中,所以更像是
{
"data":[
{"cartid":123,
"priceId":11}]
}
Run Code Online (Sandbox Code Playgroud)
有没有办法在调用之前转换为body的请求对象
JsonServiceClient _restClient = new JsonServiceClient(baseUrl);
JsonObject oneResponse = _restClient.Post(options);
Run Code Online (Sandbox Code Playgroud)