I've result from MongoDB called by "mongoDBResult"
[{
"_id": {
"$oid": "57e8e914c2ef164375bc0957"
},
"user": "456"
},
{
"_id": {
"$oid": "57e8ea87bd966f3e6de5361b"
},
"user": "admin"
}]
And my Class define
public class Id
{
public string oid { get; set; }
}
public class User
{
public Id _id { get; set; }
public string user { get; set; }
}
But when i use JsonConvert.DeserializeObject like this :
var user = JsonConvert.DeserializeObject<List<User>>(mongoDBResult);
I can get value of user name , and i want to get value of Id.oid but still always null
Anyone can help me how to convert from MongoDB to C# Class with perfect way ?