请问一下,C#中RestSharp组件发Jason串如何添加列表元素。
程序代码:
{ "credential": { "user_id": "107815", "session_id": "979457350307389", "account_id": "C-107815-0" }, "request_object": { "vendor_id_list": [ "5Q01200000000051", "5Q01200000000052" ] } }
就类似上面的 vendor_id_list, 发送端怎么写入到jason串中呢, 对于非jason串, 其写入方式如下:
var body = new { credential = new { user_id = UIGlobal.Config.UserNo, session_id = m_SessionId, account_id = acountNo }, request_object = new { vendor_id_list = Customer } };
GwDll.InputUpperLog(body.ToString(), UIGlobal.UPPER_SEND); // 上手发送日志
request.AddParameter("application/json; charset=utf-8", JsonConvert.SerializeObject(body), ParameterType.RequestBody);