tomnomnom / gron

Make JSON greppable!
MIT License
13.76k stars 326 forks source link

Document compatibility of json filters #45

Closed plainas closed 6 years ago

plainas commented 6 years ago

I use this tool all the time to automate tasks over json APIs with shellscripts. It's the quickest way to get a working jq selector. Most of the times it works, but I take it that compatibility is not full.

It would be nice to have the limitations documented in the readme.

tomnomnom commented 6 years ago

Hi @plainas :)

Can you give me an example of the limitations you're referring to? I don't know of any JSON documents that gron is unable to handle

plainas commented 6 years ago

Well, it has actually worked for me. I don't know if I ever found a selector that is not jq compatible. If I did I can't recall it specifically. I was under the impression, from the discussions on hacker news when this was posted a while ago, that it was not intended to be fully compatible with jq. But maybe I got it wrong. Is it? Are the paths always valid jq selectors?

Hey, thanks for such useful tool.

tomnomnom commented 6 years ago

Ah, I think I misunderstood your original point sorry!

Compatibility with jq isn't a design goal for gron, but outputting valid JavaScript is (by default at least). I'm not familiar enough with jq's selector syntax to know for sure if it's always compatible, but gron's output grammar is fairly simple, and is defined here if you want to see if it's likely to ever spit out anything that's incompatible: http://tomnomnom.github.io/gron/

I'm glad gron fits your use-case so far! Sorry I couldn't be of more help!