using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Nodes;
public static void Test()
var json = JsonNode.Parse("""{ "foo" : [1,2, 3] }""");
var path = JsonPath.Parse("""$.foo[*].length()""");
var results = path.Evaluate(json);
var resultJson = JsonSerializer.SerializeToNode(results.Matches.Select(m => m.Value))!.AsArray();
Console.WriteLine(resultJson);
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("System.Text.Json version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("{0} version: {1}", typeof(JsonPath).Namespace, typeof(JsonPath).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");