|
|
|
|
|
by mhansen
5160 days ago
|
|
I like jsonpipe better - then you don't have to remember all the command line flags, and you can compose pipes with your familiar unix tools. https://github.com/dvxhouse/jsonpipe $ echo '{"a": 1, "b": 2}' | jsonpipe
/ {}
/a 1
/b 2
$ echo '["foo", "bar", "baz"]' | jsonpipe
/ []
/0 "foo"
/1 "bar"
/2 "baz"
|
|
It also seems to handle typical use cases inelegantly. Probably the most common thing I use Jshon for is turning json into a tab deliminated text file. To compare both, here is a query that returns json search results:
If I want to get the name, version, votes and description into a single tab deliminated output with jshon: With jsonpipe it looks like: Most of that awkwardness is from `paste` really wanting real files to operate on. But if you are going to use jsonpipe, you might as well just write the whole thing in Python.The one thing that I do like about jsonpipe is that each line has the fully self contained path. So you can shuffle (or otherwise destroy) the output but still have something with usable context. Except for the example above, where the order matters a lot. For really simple cases jsonpipe's method is nice. I might just port it to C so that there can be a fair comparison.