jsongrep is a new Rust-based CLI tool for querying JSON documents using a regular language query syntax compiled into a deterministic finite automaton (DFA). Unlike jq, jmespath, or jsonpath-rust which interpret path expressions at runtime, jsongrep compiles queries into a DFA upfront using Glushkov's construction and subset construction algorithms, then walks the JSON tree exactly once with O(1) state transitions and aggressive subtree pruning. The post explains the five-stage pipeline (JSON parse, query parse, NFA construction, DFA determinization, DFS traversal), walks through a concrete example, and presents benchmarks showing jsongrep significantly outperforms competing tools on end-to-end search over large (~190 MB) datasets. Trade-offs include higher query compile time and a less expressive query language compared to jq (no filters, arithmetic, or transformations).
Table of contents
A Whirlwind Tour of jsongrepThe jsongrep PitchThe jsongrep Anti-Pitchjsongrep 's DFA-Based Query EngineBenchmarking MethodologyBenchmark ResultsLinksReferencesSort: