3 ms·
I see this is a Java library, but if you're in the command line (or even if you are able to call an external process for the job) jq[1] is great. [1]: https://
by fiatjaf 10y ago
I see this is a Java library, but if you're in the command line (or even if you are able to call an external process for the job) jq[1] is great.
[1]: https://stedolan.github.io/jq/manual/ https://stedolan.github.io/jq/manual/
- donpdonp 10y agoI was hoping jolt was a command line tool in the style of jq. I dont believe jq does transformations of json, only queries.
- mdaniel 10y ago> I was hoping jolt was a command line tool in the style of jq. I dont believe jq does transformations of json, only queries. I guess that depends on one's definition of transformation but: echo '{"hello": "world"}' | jq '{brave:{"new": .hello}}' it also doesn't even require JSON input, meaning one could use it strictly for composing valid output JSON: # where -n = null input jq -n --arg foo bar '{"meet me": ("at the "+$foo)}' I use it for transforming AWS responses all the time. I put jq up there with vim as one of the "must have" tools. In fact, the keys `%!jq .` are burned into my fingers because I type them a lot _ed: fixed a mobile character replacement, added in the --arg flag I couldn't remember at the time_
- dozzie 10y agoYou should rather look at App::RecordStream. Last time I compared them jq was a poor cousin of App::RecordStream.
- fiatjaf 10y agoIt does! And you can do wonders with it. It has functions that make it capable of doing almost anything. Also, my project https://requesthub.xyz/ https://requesthub.xyz/ relies entirely on the transformation capabilities of jq. See real world examples of jq transformations in this context: https://gist.github.com/fiatjaf/1d57953aa285b9bf5b51712268cfb97b https://gist.github.com/fiatjaf/1d57953aa285b9bf5b51712268cf...
- teej 10y agoI wanted to really use and love jq but I always struggle with the syntax and debugging is a huge pain. I feel that better documentation of complex examples and chaining would get me over the line.
- mariodiana 10y agoI did XSLT years ago and had far less of a problem learning my way around stylesheet syntax, and that was that bad old XML, don't you know. I was looking into Jolt just a week or two ago and ended up having a really rough time. I think if there was a more deliberate tutorial, it might be easier to learn. But the Javadocs and the hairball of example transformations were something I found confusing.
- partycoder 10y agoI came here to say exactly the same thing. jq is a great tool, very fast as well... and easy to deploy (just an executable with no library dependencies).