Home > DeveloperSection > Forums > Can Json.Net handle a List<object>?
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    January-28-2014 11:54 PM

 C# C# 
Ratings:


 1 Reply(s)
 1313  View(s)
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



Pravesh Singh

Total Post:411

Points:2881
Posted on    January-29-2014 12:51 AM

Hi Royce,

This might help:

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


Don't want to miss updates? Please click the below button!

Follow MindStick