JSON.Net如何序列化词典<enumeration,enumeration =“”>?</enumeration,>

时间:2014-11-06 18:54:45

标签: json

JSON.Net如何序列化词典?

或字典,其中MyClass包含两个枚举?

1 个答案:

答案 0 :(得分:0)

尝试:

var reqUsers = from user in users
        select new
        {
            username = user.username,
            firstName = user.firstName,
            lastName = user.lastName,
            email = user.email
        };

var json = JsonConvert.SerializeObject(new { users = reqUsers });