5 ms·
We recently implemented a subset of JQ in Clojure, converting filters and functions into Clojure predicates to allow our users to apply (K)JQ queries directly t
by d_t_w 6y ago
We recently implemented a subset of JQ in Clojure, converting filters and functions into Clojure predicates to allow our users to apply (K)JQ queries directly to Kafka topics holding JSON-like data (e.g Avro, Json, Transit, etc). If it's maps or vectors it works.
The basic implementation is predicate composition as we support multiple combinations of filters.
I hadn't thought any deeper about 'traversal systems' or optics, just parsing a grammar, creating predicates, and composing them. This is an interesting read, perhaps I should take the Clojure impl. further.
https://www.youtube.com/watch?v=7krDIMjVzZM https://www.youtube.com/watch?v=7krDIMjVzZM
Probably the most fun coding I've done this year because I had an excuse to use the wonderful Instaparse again.