Skip to content

Input Handling

jkit reads JSON from one of two places, in this order:

  1. stdin — when something is piped in or a file is redirected.
  2. System clipboard — when stdin is an interactive terminal (nothing piped in).

You never need to specify which one to use. jkit figures it out by checking whether stdin is a character device.

Pipe

bash
echo '{"a":1}' | jkit f
curl -s https://api.example.com/user | jkit f

Redirect from a file

bash
jkit f < data.json

Clipboard fallback

When you run jkit f without piping anything in, it reads from the clipboard. This is the most ergonomic mode for one-off use:

bash
# 1. Copy a JSON blob from anywhere (a browser, an editor, a chat...)
# 2. Run:
jkit f

Clipboard isn't magic

The clipboard fallback only triggers when stdin is a terminal. So if you cat empty.json | jkit f and empty.json is empty, you get the empty-stdin error — not the clipboard. This avoids surprising behavior in scripts.

When there's no input

If stdin is empty and the clipboard is empty, jkit exits with code 1:

bash
> jkit f
jkit: no input from stdin or clipboard

Linux: clipboard requires xclip or xsel

See Installation › Linux clipboard support.