using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
JObject j2 = JObject.FromObject(new { nestedkey1 = "value1", nestedkey2 = "value2" });
JObject j = JObject.FromObject(new {key1 = "value1", key2 = "value2", key3 = j2});
string json = JsonConvert.SerializeObject(j);