Command line
Open, pipe and compare JSON from any terminal with the pandia command.
Install the command
Open Settings → Behavior → terminal command and click
Install pandia command. Then open a new terminal and run
pandia --help.
- macOS creates
/usr/local/bin/pandia. macOS may ask for your password. Homebrew installs the command with the app; ifpandiaisn't found after a Homebrew install, runbrew reinstall --cask pandiaonce. - Windows creates
pandia.cmdin Pandia's data folder and adds that folder to your user PATH. - Linux creates
~/.local/bin/pandia. If your shell can't find it, add~/.local/binto your PATH.
Open files
pandia data.json
pandia a.json b.json
curl -s https://api.example.com/users | pandia -
pandia --diff old.json new.json
pandia config.json --schema config.schema.json If Pandia is already open, each file opens as a new tab in that window. The command returns straight away, so your terminal stays free.
- opens whatever is piped in, in a tab named stdin. While the tab
is open, Pandia keeps a temp copy that only your account can read, and deletes it when you close
the tab. Save asks where to keep it. YAML, CSV and broken JSON are converted or repaired the same
way as files you open.
--diff opens the first file in Compare against the
second. --schema fills the Schema panel for every file the command opens; see
Validate.
Wait for Pandia
--wait keeps the command running until you close every tab it opened. Its exit
code tells a script what happened:
| Code | Meaning |
|---|---|
| 0 | You closed the tabs and the Schema panel showed no errors. |
| 1 | The Schema panel showed errors, a file didn't open, or Pandia quit before you closed the tabs. |
| 2 | The command was mistyped. Pandia prints what to fix. |
| 3 | Piped input was closed without saving, so nothing was sent back. |
pandia --wait config.json --schema config.schema.json && echo "config is valid" Review piped JSON and send it back
With --wait, piped input becomes a review step for a script or an AI agent. A
bar in the tab says a terminal is waiting. Edit the JSON, press Save
(⌘S) to send it back, then close the tab. The command prints the saved JSON.
cat draft.json | pandia --wait - --schema config.schema.json > config.next.json && mv config.next.json config.json Closing the tab without saving sends nothing and exits with 3, so && stops the
rest of the script. Write to a new file as above: > empties its target as soon as the
command starts, so redirecting straight into config.json would leave it empty.
Get a report your script can read
Add --json to --wait and the command prints one JSON report when the
tabs close, instead of the document:
{
"exitCode": 1,
"files": [
{
"path": "/work/config.json",
"opened": true,
"saved": true,
"valid": false,
"errorCount": 1,
"errors": [{ "pointer": "/retries", "message": "\"3\" is not of type \"integer\"" }],
"problem": null
}
]
} Each error names its location as a JSON Pointer. valid is null when no
schema ran. problem says why a file didn't open or why its schema couldn't be used.
Piped input has a path of null, and once saved, its JSON is in
content.
Use Pandia as git's diff tool
git config --global difftool.pandia.cmd 'pandia --wait --diff "$LOCAL" "$REMOTE"'
git difftool --tool=pandia -- data.json On Windows, write pandia.cmd instead of pandia in the first line.
Options
| Option | What it does |
|---|---|
- | Open what is piped in. |
--schema <path|url> | Validate the opened files against this schema. |
--diff <a> <b> | Open a in Compare against b. |
--wait | Return after you close the opened tabs. |
--json | With --wait, print a JSON report of what happened. |
-h, --help | Show the options. |
-v, --version | Show the installed version, like pandia 1.0.8. |
-- | Treat every name after it as a file, like pandia -- -data.json. |