我无法在C#中使用Newtonsoft将DirectoryServices SearchResult序列化为JSON。
我希望做这样的事情:
string serialized = JsonConvert.SerializeObject(searchResult.Properties);
期待收到:
{
"cn": "Some User",
"accountexpires": 0,
"msexchuseraccountcontrol": 0,
"badpasswordtime": 131710299813433259,
"someTrueArray": [1, 2, 3]
}
相反,我得到了这个(用字符串和整数创建数组):
{
"cn": ["Some User"],
"accountexpires": [0],
"msexchuseraccountcontrol": [0],
"badpasswordtime": [131710299813433259],
"someTrueArray": [1, 2, 3]
}