using Newtonsoft.Json.Linq;
public static void Main()
""file.txt"": ""foo.bar""
JObject root = JObject.Parse(json);
Console.WriteLine(((JObject)root.SelectToken("$..['nested.txt']")).ToString());
Console.WriteLine(((string)root.SelectToken("$..['file.txt']")).ToString());
public static class JsonExtensions
public static string[] PathAsArray (this JToken token)
return token.AncestorsAndSelf()