antonmedv

Fx

Command-line tool and terminal JSON viewer ?
Under MIT License
By antonmedv

cli json


* Function eXecution



Command-line JSON processing tool


Features

Install

bash
npm install -g fx

Or via Homebrew
bash
brew install fx

Or download standalone binary from releases


Usage

Start interactive mode without passing any arguments.
bash
$ curl ... | fx


Or by passing filename as first argument.
bash
$ fx data.json


Pass a few JSON files.
bash
cat foo.json bar.json baz.json | fx .message


Use full power of JavaScript.
bash
$ curl ... | fx '.filter(x => x.startsWith("a"))'


Access all lodash (or ramda, etc) methods by using .fxrc file.
bash
$ curl ... | fx '_.groupBy("commit.committer.name")' '_.mapValues(_.size)'


Update JSON using spread operator.
bash
$ echo '{"count": 0}' | fx '{...this, count: 1}'
{
"count": 1
}


Extract values from maps.
bash
$ fx commits.json | fx .[].author.name


Print formatted JSON to stdout.
bash
$ curl ... | fx .


Pipe JSON logs stream into fx.
bash
$ kubectl logs ... -f | fx .message


And try this:
bash
$ fx --life


Documentation

See full documentation.


Links

Related

License

MIT