当我尝试转换具有结构
的动态数据时,我有错误" [" myvalue1"" myvalue2"]"
列表
我向服务发送请求的功能
List<string> SFRecipients = new List<string>();
SFRecipients.Add("myvalue1");
SFRecipients.Add("myvalue2");
var jsonSerialiser = new JavaScriptSerializer();
string jSFRecipients = jsonSerialiser.Serialize(SFRecipients);
uri = "http://testservices.com/Send";
client = new RestClient(uri);
request = new RestRequest(Method.POST);
request.AddParameter("SFRecipients", jSFRecipients);
response = client.Execute(request);
服务功能
public void Send(JObject data)
{
dynamic Mydata= data;
//Mydata.SFRecipients is = ["myvalue1","myvalue2"]
// i have debuged
List<string> Recipients = Mydata.SFRecipients.ToObject<List<string>>();
然后我得到错误
错误转换价值&#34; [&#34; myvalue1&#34;,&#34; myvalue2&#34;]&#34;键入&#39; System.Collections.Generic.List`1 [System.String]&#39;。路径&#39;
我在这里缺少什么?