RestSharp AddParameter

问题描述 投票:0回答:1

我想制作一个RestSharp请求,以下所需的结果如下:

tes = {
"paye": "0",
"type": "0",
"lines": [
   {
      "desc": "1",
      "note": "10",
   },
   {
      "desc": "2",
      "note": "20",
   },
   {
      "desc": "3",
      "note": "30",
   }
]
}

所以我提出这样的请求:

 var client = new RestClient(url);
 var request = new RestRequest("tes", Method.POST);
 request.AddParameter("paye", 0);
 request.AddParameter("type", 0);

问题是如何完成行[]部分?

谢谢

c# json restsharp
1个回答
0
投票

创建类如:

class tes {
//include all the properties here
}

序列化对象并使用RestSharp请求将其传递给参数。

© www.soinside.com 2019 - 2024. All rights reserved.