Re:How to Use JSON Path
by wwader on Friday May 03, 2024 @09:30AM
(#40247467)
Hey, fq author here. Happy to hear it's useful! could you elaborate a bit more how it was less intuitive? fq's query language is jq with some small additions so i wonder if you might mean the decoded structure is more detailed/verbose as it includes all the "low level" details? maybe your looking for the "torepr" function that converts the detailed structure into the "represented" value?
[ Parent
| on HN ]
Re:How to Use JSON Path
by ranger_danger on Friday May 03, 2024 @10:43AM
(#40248259)
Never seen this tool before but it looks quite handy. Thanks!
hope it can be of use!
Re:How to Use JSON Path
by crabmusket on Friday May 03, 2024 @07:28PM
(#40253444)
Yes that's exactly what I meant, the MsgPack documents had quite a detailed structure.
torepr didn't quite work for me as I was dealing with objects containing large binary blobs and it was awkward.
fq is a great tool and I shouldn't have suggested this was a problem unique to it! I think this kind of "issue" is inevitable when dealing with so many types of input. And to be honest I struggle hard using jq as well for anything other than very basic paths, due to infrequent usage.
I see, thanks for replying and no worries! yeap some of the "self-describing" formats like msgpack, cbor etc will because of how fq works have to be decoded into something more of a meta-msgpack etc.
About blobs, if you want to change how (possibly large) binaries are represented as JSON you can use the bits_format options, see https://github.com/wader/fq/blob/master/doc/usage.md#options, so fq -o bits_format=md5 torepr ...
I can highly recommend to learn jq, it's what makes fq really useful, and as a bonus you will learn jq in general! :)
Re:How to Use JSON Path
by crabmusket on Saturday May 04, 2024 @06:53PM
(#40260960)
Oh that's a great tip, I will try to remember this next time I'm touching the msgpacky parts of my app!