JsonDocumentPath is a class library to extract values from JSON (System.Text.Json.JsonDocument) with single line expressions
The JsonPath parser is based on the Newtonsoft.Json
stringjson=@"{ ""persons"": [ { ""name"" : ""John"", ""age"": ""26"" }, { ""name"" : ""Jane"", ""age"": ""2"" } ] }";varmodels=JsonDocument.Parse(json);varresults=models.SelectElements("$.persons[?(@.age > 3)]").ToList();Because JsonDocumentPath is using the same Json.net strategic for parsing and evaluation the following is a list of pieces were already implemented:
- ArrayIndexFilter
- ArrayMultipleIndexFilter
- ArraySliceFilter
- FieldFilter
- FieldMultipleFilter
- QueryFilter
- QueryScanFilter
- RootFilter
- ScanFilter
- ScanMultipleFilter
- JPathParseTests
- QueryExpressionTests
- JPathExecuteTests