Tool Radar: fx

less than 1 minute read

I came about a nice tool for CLI processing of JSON structures… native JavaScript, fast and intuitive from a modern JavaScript perspective.

Cool stuff… depending on how much You are into JavaScript development I recommend doing the following right now and give it a base jump:

.> npm install -g fx

.> echo '{"foo": [{"bar": "value"}]}' | fx 'x =>[0].bar'

.> echo '{"foo": [{"bar": "value"}]}' | fx 'x =>[0]'
  "bar": "value"

but one of the cooler things is this:

.> echo '{"foo": "bar"}' | fx '{...this, "ping": "pong"}'
  "foo": "bar",
  "ping": "pong"

and the coolest by far is the interactive mode:

.> curl <something> -o data.json

and off You go like this:

Showcase: fx in action

… but so much for ruthless c’n’p-ing … credits to the original author and enter stage Anton.