using System.Collections.Generic;
public static void Main()
""text"": ""Child node 2.txt"",
""id"": ""1childnode2.txt"",
""itsPath"": ""C:\\Users\\pandyapa\\Root node\\Child node 2.txt"",
""text"": ""Child node 1.txt"",
""id"": ""0childnode1.txt"",
""itsPath"": ""C:\\Users\\pandyapa\\Root node\\Child node 1.txt"",
""text"": ""Child node 2.txt"",
""id"": ""1childnode2.txt"",
""itsPath"": ""C:\\Users\\pandyapa\\Root node\\Child node 2.txt"",
""text"": ""Child node 3.txt"",
""id"": ""2childnode3.txt"",
""itsPath"": ""C:\\Users\\pandyapa\\Root node\\Child node 3.txt"",
""itsPath"": ""C:\\Users\\pandyapa\\Root node"",
List<Node> nodes = JsonConvert.DeserializeObject<List<Node>>(json);
var idToFind = "2childnode3.txt";
var node = nodes.SelectMany(n => n.DescendantsAndSelf())
.Where(n => n.Id == idToFind)
Console.WriteLine("ItsPath: " + node.ItsPath);
Console.WriteLine("Not found");
public Node[] Children { get; set; }
public string Text { get; set; }
public bool IsFolder { get; set; }
public string Id { get; set; }
public string ItsPath { get; set; }
public string Type { get; set; }
public IEnumerable<Node> DescendantsAndSelf()
foreach (Node child in Children)