Click or drag to resize
Json.NET

Create JSON manually

 

This sample creates JObject and JArray instances one at a time programatically.

Sample
Usage
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));

JObject o = new JObject();
o["MyArray"] = array;

string json = o.ToString();
// {
//   "MyArray": [
//     "Manual text",
//     "2000-05-23T00:00:00"
//   ]
// }