r/JavaProgramming • u/Treetrail1987 • Oct 09 '26
Treetrail: JSONPath for Java that follows RFC 9535 (the JSONPath standard), with Jackson/Gson/JSON-P adapters and Spring test matchers
JSONPath in Java has mostly meant Jayway JsonPath, which dates from 2011, long before the IETF standardized JSONPath as RFC 9535 in 2024. The two differ in places: filter syntax, functions, and some results ($[1:6:2] on [0..9] is [1, 3, 5] by the RFC, [1, 2, 3, 4, 5] in Jayway 3.0.0).
I wrote a Java implementation of the standard:
passes all 706 cases of the JSONPath Compliance Test Suite on Java 17, 21 and 25
every query returns a node list with normalized paths; no options that change the result shape
core without dependencies; adapters query Jackson 2/3, Gson and JSON-P trees in place
safe with untrusted queries: linear-time regex (no backtracking), node budget, depth limit, bounded regex cache memory
fast: on Jackson trees 1.2× to 2.2× faster than Jayway in every query of the JMH benchmark (numbers and caveats)
new in 0.2.0: AssertJ assertions and MockMvc/WebTestClient matchers
for switching from Jayway: a module that runs your expressions with both libraries and reports differences, and an OpenRewrite recipe that finds all expressions in a code base
It is fuzzed with Jazzer and differential-tested against a Python implementation of the standard.
Apache 2.0, on Maven Central as io.github.treetrail:jsonpath-core:0.2.0. Still pre-1.0, so feedback on the API is very welcome.
Repo: https://github.com/treetrail/treetrail Write-up: https://christoph-sens.github.io/2026/10/treetrail-standard-jsonpath-for-java/