XQ
JQ reimplemented purely in Rust.
Caution
This program is under development. You probably want to use the original implementation of jq, or pure Go implementation of it called gojq built by itchyny instead.
Current state
Most of the jq components that require syntactical support are, hmm, implemented and tested against queries taken from the jq user manual.
Exceptions are string format (@base64 etc.), imports, and module headers.
Many builtin functions are missing, include those require intrinsic implementation.
Need more unit tests. Most of the CLI options are missing.
Goals
- Learn jq.
Ideas
-
Since we use serde to deserialize input / serialize output, we should be able to support any format which has serde implementation without too much effort, except those require scheme (protobuf, thrift, etc.).
-
As a library, we should be able to make anything that implements
Serializeas the input type, and anything implementsDeserializeas the output type. So in theory, we should be able to write a library that can handle following;let repos: = fetch_repos; let users: = somefunction_slurp.collect;I mean, it's not something that one should really use. It's just something possible and interesting... isn't it?
Usage
Do you really want to use it??? Currently, you need to clone this repository and do
cat whatever.json | cargo run -- 'query goes here'
Acknowledgements
- Although this isn't a direct translation at all, I referred to jq built by Stephen Dolan and gojq built by itchyny. Thank you for the interesting product!
Credits
- Test cases in tests/from_manual are taken from the jq user manual, distributed under CC BY 3.0, Copyright (C) 2012 Stephen Dolan. Please refer to mod.rs there for more detail.
Author
LICENSE
MIT. Please refer to LICENSE file.