如何使用RestClient将值传递到json内部

时间:2019-01-09 07:49:43

标签: c# rest django-rest-framework

我们如何将值传递给Josn下面的详细信息部分

JSON文件

{
  "firstName": "JB000123",
  "LASTNAme": "SHP0000123",
  "details": [
    {
      "a": "Full Trucking Load",
      "b": "2",
      "c": "USD"
    },
    {
      "a": "Ocean Freight",
      "b": "2",
      "c": "USD"
    }
  ]
}

如何在“详细信息”部分添加记录

var client = new RestClient(URL);
client.Authenticator = new HttpBasicAuthenticator(Username, Password);
var request = new RestRequest("/xyz/xyzz/", Method.POST);
request.AddParameter("firstName", "Test"); 
request.AddParameter("LASTNAme", "Tets Last Name"); 
request.AddParameter("details", ???); 

IRestResponse response = client.Execute(request);
var content = response.Content;

0 个答案:

没有答案