You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JEX is a high-performance, low-GC JSON path extractor for Java, designed for both in-memory and streaming scenarios. It supports multi-path extraction in a single pass using a Trie-based engine, with early termination for both single and multi-path queries. JEX is optimized for large files, streaming JSON, and high-concurrency/low-memory environments。
✨ Features
Trie-based multi-path extraction: Extract multiple JSON paths in a single traversal.
Single-pass, low-GC: No object tree, no unnecessary allocations, minimal garbage collection.
Early termination: Stops parsing as soon as all target paths are found (single or multi-path).
String and stream modes: Use fast in-memory (char[]) mode or true InputStream streaming for large files.
Supports all JSON structures: Objects, arrays, nested, null, boolean, numbers, strings, etc.
Compatible with InputStream: Ideal for large files, streaming, or memory-constrained environments.
📊 Performance Comparison
Single Path Extraction (by Field Position)
Library/Mode
Front
Middle
End
JEX string (char[])
137 ms
3223 ms
1159 ms
JEX stream
5305 ms
3191 ms
9877 ms
Jayway JsonPath
3031 ms
3008 ms
3059 ms
Fastjson
3389 ms
3370 ms
3454 ms
Gson
3005 ms
3069 ms
3174 ms
Jackson
2716 ms
2881 ms
2696 ms
Multi-Path Batch Extraction
Library/Mode
Multi-Path Batch (front/mid/end)
JEX string (char[])
4368 ms
JEX stream
9877 ms
Jayway JsonPath
3201 ms
Fastjson
3463 ms
Gson
3174 ms
Jackson
6415 ms
Tested on 100,000 iterations, medium-large(24K) JSON, macOS. See JsonPathBenchmarkTest for details.
⚡ JEX String vs Stream Mode
Mode
Single Path (front-field)
Single Path (mid-field)
Single Path (end-field)
Multi-Path (front/mid/end)
JEX string (char[])
116 ms
3191 ms
1273 ms
4738 ms
JEX stream
5037 ms
5305 ms
11334 ms
9877 ms
String mode (char[]) is always the fastest and is recommended when the JSON fits in memory and you want maximum performance.
Stream mode (InputStream/BufferedReader) is optimized for very large files or low-memory environments. It is slightly slower due to I/O and per-character parsing, but supports true streaming and early termination for multi-path extraction.
💡 When to Use JEX
Large or streaming JSON: Stream mode is ideal for huge files or when memory is limited.
High concurrency: Low allocation and no object tree means minimal GC impact.
Multi-path extraction: Need to extract many fields at once, with early exit for best performance.
Performance critical: Outperforms most mainstream libraries for path extraction, especially for single/multi-path queries.
JEX supports basic JSONPath-like syntax such as $.a.b[0], and the leading $ is optional (e.g., a.b[0] is also valid).
Only dot . for object access and [n] for array index are supported.
Full standard JSONPath (such as wildcards, recursive descent, filter expressions, etc.) is NOT supported, by design, to ensure maximum performance for direct path extraction.
Invalid or non-existent paths return null.
About
High-performance JSON path extractor. Trie-based, single-pass, low-GC, multi-path extraction with stream processing support — optimized for large or streaming JSON.