using System.Collections.Generic;
public static void Main()
{ text: '', value: undefined },
{ text: 'Standardowe SLA', value: 1 },
{ text: 'Realizacja w trybie a vista', value: 2 }
var list = new List<string>
Account account = new Account
Email = "james@example.com",
CreatedDate = new DateTime(2013, 1, 20, 0, 0, 0, DateTimeKind.Utc),
Roles2 = JsonConvert.SerializeObject(list)
string json = JsonConvert.SerializeObject(account, Formatting.Indented);
var a = JsonConvert.DeserializeObject<Account>(json);
Console.WriteLine(a.Roles2);
var l = JsonConvert.DeserializeObject<List<string>>(a.Roles2);
var empty = JsonConvert.DeserializeObject<Account>(string.Empty);
Console.WriteLine(string.Format("EMPTY: {0}", empty));
var x = JsonConvert.DeserializeObject<Account>(null);
Console.WriteLine(string.Format("NULL: {0}", x));
public string Email { get; set; }
public bool Active { get; set; }
public DateTime CreatedDate { get; set; }
public IList<string> Roles { get; set; }
public string Roles2 { get; set; }