C# 将json列表保存到自定义模型列表时出现问题
我可以反序列化一个json对象,但在RESTAPI发送json对象列表时遇到问题。我的模型C# 将json列表保存到自定义模型列表时出现问题,c#,json,rest,C#,Json,Rest,我可以反序列化一个json对象,但在RESTAPI发送json对象列表时遇到问题。我的模型 public class ToDoItem { public string AdId { get; set; } public string Category { get; set; } public string CategoryGroup { get; set; } public string Title { get; se
public class ToDoItem
{
public string AdId { get; set; }
public string Category { get; set; }
public string CategoryGroup { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string PlaceName { get; set; }
public string Voivodeship { get; set; }
public string Price { get; set; }
public string Negotiable { get; set; }
public string AdType { get; set; }
}
以及保存到列表的方法片段
您的“json格式示例”不是有效的json。请提供可用于重现问题的代码示例。此外,不清楚你所说的“我有问题”是什么意思。如果您遇到异常或数据未填充,请提供异常信息和\或澄清您遇到的问题。
response = await client.GetStringAsync("myUrl");
if (!string.IsNullOrEmpty(response))
{
adList = JsonConvert.DeserializeObject<List<ToDoItem>>(response);
}
adList:
[
{parameter},
{parameter}
]