Thursday, September 22, 2011

LitJSON lib C#

to map C# objects from and to JSON this little library is all you need:

http://litjson.sourceforge.net/doc/manual.html#quickstart.mapping
http://litjson.sourceforge.net
    public static void PersonToJson ()
{
Person bill = new Person ();

bill.Name = "William Shakespeare";
bill.Age = 51;
bill.Birthday = new DateTime (1564, 4, 26);

string json_bill = JsonMapper.ToJson (bill);

Console.WriteLine (json_bill);
// {"Name":"William Shakespeare","Age":51,"Birthday":"04/26/1564 00:00:00"}
}

No comments:

Post a Comment