5 ms·
Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, gr
by avidal 7y ago
Have you seen gron[0]? It's similar: flattens JSON documents to make them easily greppable. But it also can revert (ie, ungron) so you can pipe json to gron, grep -v to remove some data, then ungron to get it back to json.
[0] https://github.com/tomnomnom/gron https://github.com/tomnomnom/gron
- Fnoord 7y agoActively developed and written in Go. The project linked to is from 2014 with last update in 2015.and it is on NPM... What is left to say? Thank you!
- heyoni 7y agoUsed to be written in php right?
- inoyeh 7y agoThis "joke" is so incredibly old.
- edflsafoiewq 7y agoWhat's wrong with it not being updated in 5 years? It's a simple script. It's probably stable and doesn't need to be "actively developed".
- sethammons 7y agoI see this sentiment a lot. I agree with you, simple things can be done and don't need active development.
- Apaec 7y agoI much prefer jq[1]. Actively developed and written in C. [1]:https://github.com/stedolan/jq https://github.com/stedolan/jq
- inferiorhuman 7y agoWhat does grep + gron give you over jq?
- webo 7y agoas far as i can tell, jq doesn't do flattening .
- lucb1e 7y agoMaybe GP meant that jq can do selection as well, i.e. that grepping is redundant after jq. But jq is much more complicated to learn and grep works on all inputs (not just json), so it makes a lot more sense to learn and use grep properly.
- pstuart 7y agoNot built in, but @jolmg posted a script here which does the needful.
- pfranz 7y agojq seems very powerful. I don't deal with json all that often and my most common use case (by far) is `jq '.' -C` and it took a few tries for me to remember that syntax. The idea of flattening, grepping, then reverting sounds very appealing and sounds like a better fit for me.
- jolmg 7y ago> `jq '.' -C` and it took a few tries for me to remember that syntax. I don't think you really need neither `.` nor `-C`. Just `jq` seems to do the same colored output of the input by default.
- pfranz 7y agoIt does look like neither are needed if you pipe a file in jq, but `jq . file.json` requires the `.` and if you're pipeing into a pager, like less, you need both `.` and `-C` to get colored output (that was the case with the alias I had pulled up). I am using 1.5 and haven't looked to see if 1.6 changes this.
- wooby 7y agoI haven't seen that one, but it looks very similar to the one I use: https://github.com/micha/json-table https://github.com/micha/json-table
- krick 7y agoThat's actually a nice lifehack. Much simplier than jq. Unfortunately, would be harder to make all kinds of logical conditions for which jq allows (even if not that intuitively). It still feels like there must be something in between, some way to make queries with json more naturally, than with jq, yet with enough power.
- jolmg 7y agojq is certainly a unique language, which makes it unfamiliar to work with. Intuitiveness and natural feeling comes when one has gotten familiar with it after a bit of practice and reading the manual, though. It's a very well thought-out language. A very nice design. It might help to recognize how it's influenced by shell languages and XPath, if you're familiar with those.
- krick 7y agoWell, no arguing there, it is indeed. And I use it from time to time. However, it's not like I need a tool like that every day, and if I'm no using it for a week I usually need to "learn" it all over again.
- news_hacker 7y agoLove the greppability and reconstructability. This should be the submission.