Getting Started 
Fx is a CLI for JSON: it shows JSON interactively in your terminal, and lets you transform JSON with JavaScript. Fx is written in Go and uses goja as its embedded JavaScript engine.
Run this command to start fx in interactive mode:
fx data.jsonJSON Processing 
In fx, arguments are treated as JavaScript functions. Input data is passed sequentially through each provided function:
echo '{"name": "world"}' | fx 'x => x.name' 'x => `Hello, ${x}!`'Hello, world!You can also utilize standard JavaScript functions:
echo '{"name": "world"}' | fx 'Object.keys'[ "name" ]Fx also introduces syntactic sugar to enhance simplicity:
- Reference input data using 
xorthis. - Start expressions with 
.to avoid repeating thex => x. 
echo '{"name": "world"}' | fx .name '`Hello, ${x}!`'Hello, world!That's it. So simple!
INFO
Fx is short for f(x), capturing the essence of applying a function to input data.
Streaming Mode 
Fx is designed to handle both line-delimited JSON and concatenated JSON streaming:
echo '{"text": "Hello"}{"text": "World!"}' | fx .textHello
World!For collective processing of a JSON stream as a single array, use the --slurp or -s flag:
echo '{"text": "Hello"}{"text": "World!"}' \
| fx --slurp '.map(x => x.text)' '.join(", ")'Hello, World!Interactive Mode 
Fx provides an interactive mode that allows you to explore JSON interactively. To initiate the interactive mode, pipe JSON into fx:
curl -i https://fx.wtf/example.json | fxTIP
Yes, fx can show curl headers (with the -i flag) in the interactive mode.
Or:
fx example.jsonTIP
If you forget the available commands, press ? to display the key bindings.
Navigating 
Easily navigate through your JSON using arrow keys or Vim keys.
Press . to adjust the current path. Press tab or . to accept the current suggestion.
Press @ to start a fuzzy search of JSON paths and jump to the first match.
Press [ or ] to jump to the previous location or to the next location in history.
Searching 
Press /, enter a regex pattern, press enter. Navigate to the next search result with n and to the previous search result with N.
By default, the search is case-insensitive. However, you can modify search sensitivity:
Case-Sensitive: Add / at the end of the pattern.
/[a-z]/Case-Insensitive: Append the /i flag.
/[a-z]/iPrinting 
Fx uses stderr for rendering, allowing you to print values to stdout.

Press p to preview the current value. Press P to print the value to stdout.
You can use fx to select only a specific part of the JSON and save it to a file:
curl ... | fx > output.jsonThis command will run fx in the interactive mode, so you can navigate JSON, find the necessary part, and press P to print it to output.json.
To simply pretty-print the whole JSON to output.json, use:
curl ... | fx . > output.jsonText Selection 
Text selection in fx differs due to mouse event redirection to stdin. Depending on your terminal, use specific key combinations to select text:
| Key | Terminal | 
|---|---|
| fn | Terminal.app | 
| option | iTerm2, Hyper | 
| shift | Linux | 
TIP
To disable mouse event redirection, specify the FX_NO_MOUSE environment variable.