10/04/2016

gron - Making JSON greppable!

Today, I friend of mine shared in our internal chat at iAdvize: gron, "Make JSON greppable!".

gron transforms JSON into discrete assignments to make it easier to grep for what you want and see the absolute 'path' to it. It eases the exploration of APIs that return large blobs of JSON but have terrible documentation.

Great idea right? When I first saw this, I wondered if it could be done with jq and sadly it seems it does not. Looking at gron Go source code was frightening. What a huge load of code for something that simple, there must be an easier way! And indeed, there was:

I just installed flat npm package an piped it through node and voila! For extra usability it could be wrapped I wrapped it into a gron npm package with support for valid JavaScript output, variable name escaping and so on.

Conclusion: it's often better (faster and safer) to stand on the shoulders of giants than to reinvent the wheel.

« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.