Skip to content

Commit 9b6838d

Browse files
cursoragentsimbo1905
andcommitted
Issue #128 Make JsonPath an interface
Co-authored-by: simbo1905 <simbo1905@60hertz.com>
1 parent d943174 commit 9b6838d

File tree

4 files changed

+604
-546
lines changed

4 files changed

+604
-546
lines changed

json-java21-jsonpath/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ var titles = JsonPath.parse("$.store.book[*].title").query(doc);
1919
var cheap = JsonPath.parse("$.store.book[?(@.price < 10)].title").query(doc);
2020
```
2121

22+
## Runtime Compilation (Optional)
23+
24+
`JsonPath.parse(...)` returns a reusable `JsonPath` instance. By default this evaluates by walking an internal AST.
25+
For hot paths, you can optionally request a JDK-compiled evaluator at runtime:
26+
27+
```java
28+
JsonPath path = JsonPath.parse("$.store.book[*].title").compile();
29+
var titles = path.query(doc);
30+
```
31+
32+
- If the runtime Java compiler is unavailable, `compile()` returns the original (AST-backed) implementation.
33+
- Calling `compile()` on an already-compiled `JsonPath` is a no-op (it returns itself).
34+
2235
## Syntax At A Glance
2336

2437
Operator | Example | What it selects

0 commit comments

Comments
 (0)