Feature request: "raw" output flag
pieterbreed opened this issue · comments
This is a request to implement a the -r
flag from jq
. This flag allows for printing a string value from a query or fn, without wrapping in quotes and doing character escaping.
From jq manual:
--raw-output
/-r
:
With this option, if the filter's result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems.
I recently had to do this: $ <something-producing-edn> | jet -q ':some-field' | jq -r
If jet
had the -r flag, jq would not have been required here.
@pieterbreed In many cases you can already accomplish this with:
jet -q ':some-field symbol'
Does that solve your problem?
Else we can maybe specify the solution more generally by making the printer function pluggable:
--print-fn prn / println
The default is prn (or pretty-print) but println would omit quotes.
Documented here: https://github.com/borkdude/jet#raw-output
Hi @borkdude - thank you for the prompt response.
I think the documentation is maybe missing something.
or simply use println to get rid of the quotes
$ echo '{"a": "hello there"}' | jet --from json --keywordize --query ":a symbol" --to edn
hello there
I'm not seeing println
in the example; this looks like a copy-pasta maybe?
Fixed