npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@chiefdfo/jsonatacli

v0.2.0

Published

Run JSONata transforms over JSON, CSV, XML, and YAML from the command line. Runs transform/pipeline files exported from JSONata Studio.

Readme

jsonatacli

Run JSONata transforms over JSON, CSV, XML, and YAML from the command line.

It runs transform and pipeline files exported from JSONata Studio — design a transformation visually in the Studio, click Export CLI, and run the downloaded .json against your data anywhere.

Install

npm install -g @chiefdfo/jsonatacli     # global command
# or run without installing:
npx @chiefdfo/jsonatacli run transform.json --input data.json

Requires Node.js >= 22.

Usage

jsonatacli run  <transform.json> [options]   # run an exported Studio transform/pipeline file
jsonatacli eval <expression>     [options]   # run a raw JSONata expression (jq-style)

Options

  -i, --input <file|glob>     input file(s); omit to read stdin
  -o, --output <file>         output file; omit to write stdout
      --out-dir <dir>         batch mode: one mirrored output file per input
      --input-format  <fmt>   json|csv|xml|yaml (overrides extension)
      --output-format <fmt>   json|csv|xml|yaml (overrides extension; default json)
      --functions <file>      external custom-function definitions, merged over embedded
      --step <n>              pipeline only: emit step n's intermediate output (1-based)
      --timeout <ms>          best-effort eval guard (async expressions only)
  -h, --help                  show help
  -v, --version               show version

Input and output formats are inferred from file extensions and can be overridden with --input-format / --output-format. With no --input, the CLI reads stdin; with no --output, it writes stdout.

Examples

# Run an exported transform, JSON in, JSON out
jsonatacli run mytransform.json --input data.json

# CSV in, YAML out
jsonatacli run mytransform.json -i people.csv --output-format yaml

# Inline expression, piped input
echo '{"items":[1,2,3,4,5]}' | jsonatacli eval 'items[$ > 2]'

# Batch: transform every CSV into a mirrored JSON file
jsonatacli run mytransform.json -i "data/*.csv" --out-dir out/

# Inspect an intermediate pipeline step
jsonatacli run pipeline.json -i data.json --step 1

Exit codes

| Code | Meaning | |------|---------| | 0 | success | | 1 | evaluation error (results go to stdout, diagnostics to stderr) | | 2 | usage / IO / parse error |

Programmatic use

The package is also an importable library — the same engine the CLI runs, minus file and stream I/O. It ships as ESM with TypeScript types.

npm install @chiefdfo/jsonatacli
import { runTransform, transform, step, pipeline } from "@chiefdfo/jsonatacli";

// Single expression
const r = await runTransform(
  '{"items":[{"price":2},{"price":3}]}',
  transform("items.price ~> $sum()"),
);
r.ok && r.value; // 5

// Convert formats: CSV in, YAML out
await runTransform("name,age\nAda,36", transform("$"), {
  inputFormat: "csv",
  outputFormat: "yaml",
});

// A pipeline — step ids are generated, object bindings are serialized for you
const paidByRegion = pipeline(
  [
    // $region comes from the shared bindings; $minNet is a per-step override
    step("orders[status = 'paid' and region = $region and amount > $minNet]", {
      bindingOverrides: { minNet: 50 },
    }),
    step("$sum(amount)"),
  ],
  { bindings: { region: "EU" } }, // shared by every step
);
const out = await runTransform(inputJson, paidByRegion);

runTransform(input, transform, options?) resolves to a discriminated result:

{ ok: true; value: unknown; output: string } | { ok: false; error: string }
  • value is the raw result; output is it serialized in outputFormat (default json).
  • options: inputFormat, outputFormat (json | csv | xml | yaml), functions, step, timeout.

To run a transform or pipeline file exported from the Studio, parse its JSON and pass it straight to runTransform — it accepts the same shape (expression, pipelineSteps, bindings, embedded functions), so the builders above are optional conveniences.

Notes

  • The bundle is self-contained (no runtime dependencies).
  • Custom functions defined in the Studio are embedded in the exported file, so they work out of the box; --functions can add or override them.
  • Input is decoded with BOM awareness (UTF-8 and UTF-16 LE/BE), so Windows PowerShell pipes (|) and redirects (>) work.

License

MIT