Using fx as a TUI for JSON Data
If you're working with JSON in the terminal, fx provides a lightweight TUI (Text User Interface) for viewing and exploring structured data interactively.
Why Use a JSON TUI?
When debugging APIs, logs, or config files, pretty-printing is often not enough. A TUI lets you navigate deeply nested JSON, expand/collapse sections, and quickly find what you need — without leaving the terminal.
Launching the TUI
cat data.json | fxOr pipe directly from a command:
curl https://api.example.com/data | fxThis opens a fullscreen TUI where you can:
- Use arrow keys to expand/collapse objects
- View arrays and nested structures interactively
Features
- Keyboard-driven — ideal for terminal workflows.
- Streaming support — works with
cat,curl,docker, etc. - Custom queries — drill into
.field.subfielddirectly or define JavaScript logic.
Example: Explore Docker Metadata
docker inspect $(docker ps -q) | fxOpens metadata of all running containers in the TUI. Press / to search, e.g. for IPAddress.
To print a summary instead of opening the TUI, pass an expression — here, containers grouped by image:
docker inspect $(docker ps -q) | fx 'groupBy(x => x.Config.Image)'Output:
{
"nginx:1.25": [
{
"Id": "abc",
"Config": {
"Image": "nginx:1.25"
}
}
]
}Summary
fx turns JSON into an interactive TUI experience — fast, intuitive, and scriptable. Perfect for developers working in CLI environments who want more than just pretty-printing.