Skip to content

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

bash
cat data.json | fx

Or pipe directly from a command:

bash
curl https://api.example.com/data | fx

This 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.subfield directly or define JavaScript logic.

Example: Explore Docker Metadata

bash
docker inspect container_id | fx 'groupBy(x => x.Config.Image)'

Prints a list of images used by the container, grouped by image name.

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.