Can Json.Net handle a List<object>?

Total Post:149

Points:1043
C# 
C#
 2436  View(s)
Ratings:
Rate this:

List<User> list = LoadUsers();

JObject json = new JObject();

json["users"] = new JValue(list);

Doesn't seem to be working?

Error:

Could not determine JSON object type for type System.Collections.Generic.List

  1. Post:412

    Points:2888
    Re: Can Json.Net handle a List<object>?

    Hi Royce,

    This might help:

    json["users"] = new JValue(JsonConvert.SerializeObject(list));

Answer