fx - Interactive JSON Explorer
Overview
fx is a terminal JSON viewer with interactive navigation. Use it to explore unknown JSON structures before writing jq queries.
|
fx is for exploration, jq is for work.
You’ll use jq 95% of the time. fx is for discovery. |
Installation
# Arch Linux
sudo pacman -S fx
# Homebrew
brew install fx
# Go
go install github.com/antonmedv/fx@latest
# npm
npm install -g fx
Quick Start
# Pipe JSON to fx
curl -s https://api.github.com/users/torvalds | fx
# From file
fx data.json
# From command output
kubectl get pods -o json | fx
hostnamectl --json=short | fx
Navigation
| Key | Action |
|---|---|
|
Move up/down |
|
Expand node |
|
Collapse node |
|
Expand all |
|
Collapse all |
|
Search |
|
Next/previous search result |
|
Print path to current node |
|
Copy current value |
|
Quit |
Workflow: fx → jq
Step 1: Explore with fx
# Unknown API response - what's in here?
netapi ise --format json get-policy-sets | fx
Navigate to the data you need, press p to print the path:
.response[0].name
Step 2: Extract with jq
# Now you know the path
netapi ise --format json get-policy-sets | jq -r '.response[0].name'
Practical Examples
Vault API
# Explore PKI certificate response
vault write -format=json pki_int/issue/domus-client common_name="test" | fx
# Navigate to .data.certificate, press 'p' → ".data.certificate"
# Now use jq:
vault write -format=json pki_int/issue/domus-client common_name="test" | jq -r '.data.certificate'
Kubernetes
# Explore pod structure
kubectl get pod mypod -o json | fx
# Find container image path, then:
kubectl get pod mypod -o json | jq -r '.spec.containers[0].image'
fx vs jq vs yq
| Feature | fx | jq | yq |
|---|---|---|---|
Interactive |
✓ |
✗ |
✗ |
Scripting |
✗ |
✓ |
✓ |
Transformations |
✗ |
✓ |
✓ |
JSON |
✓ |
✓ |
✓ |
YAML |
✗ |
✗ |
✓ |
Pipelines |
✗ |
✓ |
✓ |
Learning curve |
Low |
Medium |
Medium |
Tips
When NOT to Use fx
-
Scripting/automation → use
jq -
Pipelines → use
jq -
YAML files → use
yq -
Extracting values → use
jq -
CI/CD → use
jq
fx is human-interactive only. No scripting capability.
See Also
-
jq & yq Mastery - The real work happens here