CAN JSON.NET HANDLE A LIST<OBJECT>?

Royce Roy

Total Post:149

Points:1043
Posted by  Royce Roy
C# 
C#
 1836  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. Pravesh Singh

    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!