我发送以下内容:
{
"setIds": ["1", "2"],
"folderIds": ["3", "4"],
"filter": "FILTERED"
};
到接受SessionDto的API端点:
[DataContract]
public class SessionDto
{
[DataMember(EmitDefaultValue = true)]
public Array FolderIds { get; set; }
[DataMember(EmitDefaultValue = true)]
public Array SetIds { get; set; }
[DataMember(IsRequired = true)]
public string Filter { get; set; }
}
SetIds和FolderIds总是为空;过滤器来得很好。我正在使用newtonsoft.json.serialization。知道为什么这不起作用,或者我如何进一步调试?
答案 0 :(得分:2)
[DataMember(EmitDefaultValue = true)]
public int[] FolderIds { get; set; }
[DataMember(EmitDefaultValue = true)]
public int[] SetIds { get; set; }
[DataMember(IsRequired = true)]
public string Filter { get; set; }
尝试int数组