jaq

Jaq is a data wrangling tool focusing on correctness, speed, and simplicity

Try the program in a shell

  1. Install Nix
    Arch Linux
    Bash
    $ pacman --sync --refresh --noconfirm curl git jq nix
    Debian
    Bash
    $ apt install --yes curl git jq nix
    Ubuntu
    Bash
    $ apt install --yes curl git jq nix
  2. Download a configuration file
    # default.nix
    {
      ngipkgs ? import (fetchTarball "https://github.com/ngi-nix/ngipkgs/tarball/main") { },
    }:
    ngipkgs.demo-shell (
      { ... }:
    
      {
        programs.jaq.enable = true;
      }
    
    )
    
  3. Enable binary substituters
    Bash
    $ export NIX_CONFIG='substituters = https://cache.nixos.org/ https://ngi.cachix.org/
    trusted-public-keys = cache.nixos.org-1:6nchdd59x431o0gwypbmraurkbj16zpmqfgspcdshjy= ngi.cachix.org-1:n+cal72roc3qqulxihpv+tw5t42whxmmhpragkrsrow='
  4. Build and run a virtual machine
    Arch Linux, Debian Sid and Ubuntu 25.04
    Bash
    $ nix-build ./default.nix && ./result
    Debian 12 and Ubuntu 24.04/24.10
    Bash
    $ rev=$(nix-instantiate --eval --attr sources.nixpkgs.rev https://github.com/ngi-nix/ngipkgs/archive/master.tar.gz | jq --raw-output)
    $ nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz --packages nix --run "nix-build ./default.nix && ./result"
  5. Usage Instructions

    A demo shell for testing jaq, a data wrangling tool with formal semantics similar to jq.

    Let's get a basic understanding of jaq's capabilities:

    Here, we can pass in a set or object full of numbers and have jaq add them together.

    $ echo '{"a": 1, "b": 2}' | jaq 'add' # equal to 3

    We can also do more complicated operations like mapping over a list and using conditionals:

    $ echo '[0, 1, 2, 3]' | jaq 'map(.*2) | [.[] | select(. < 5)] | add' # equal to 6

    Finally, jaq will fail if any malformed input is passed

    $ echo "0, 1, 4, " | jaq

Options

programs.jaq
programs.jaq.enable

Whether to enable jaq.

Type:
boolean
Default:
false
programs.jaq.package

The jaq package to use.

Type:
package
Default:
pkgs.jaq

Examples

basic
{ ... }:

{
  programs.jaq.enable = true;
}

This project is funded by NLnet through these subgrants: