using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
.Where(jt => jt.Type == JTokenType.Property && ((JProperty)jt).Value.HasValues)
var obj = new JObject(new JProperty("Name", prop.Name));
if (prop.Value.Type == JTokenType.Array)
var items = prop.Value.Children<JObject>()
.SelectMany(jo => jo.Properties())
.Where(jp => jp.Value.Type == JTokenType.String);
var parentName = prop.Ancestors()
.Where(jt => jt.Type == JTokenType.Property)
.Select(jt => ((JProperty)jt).Name)
obj.Add("Parent", parentName ?? "");
for (int i = 0; i < list.Count; i++)
Console.WriteLine("list[" + i + "]:");
Console.WriteLine(list[i].ToString(Formatting.None));