jq-wasm
August 24, 2025 ยท View on GitHub
A fork of jq-web, the WebAssembly build of jq.
I forked the main project to have more control over the build process and the API interface, since it's a core component of Virtual Json Viewer browser extension.
Highlights
jqversion ~1.8emccversion ~4.0- Straightforward client API
- Typescript support
- Docker toolchain setup
- No Git submodules
Quickstart
var newJQ = require('jq-wasm')
const jq = await newJQ()
const output = await jq.invoke('{"jq": {"is": "awesome"}}', ".jq.is")
// "awesome"
Installation
The easiest way is to download the build output directly from the releases page:
| File | Description |
|---|---|
| jq.wasm.js | Javascript interface for interacting with JQ |
| jq.wasm | JQ WebAssembly binary, loaded by jq.wasm.js |
| jq.wasm.d.ts | Typescript types definition |
Reference
newJQ(module?): Promise<JQ>
Return a promise that resolves into a JQ instance after the WebAssembly runtime has been initialized.
It accepts an optional module object to overwrite emscripten default parameters.
Example: customize the path of the wasm file with newJQ({locateFile: () => "path/to/jq.wasm"})
For a complete list of available options, see the emscripten official documentation
jq.invoke(input, filter, options): Promise<string>
Run jq and return the content of stdout on success.
It's equivalent to echo <input> | jq <options> <filter>
Build
Make sure you have Docker installed and then simply
docker compose run --rm emsdk make
Output files will be in dist folder.
Yarn
It's suggested to also have Yarn installed, in order to run tests and make sure everything works as expected
# shorter alias for building jq through docker
yarn make
# run smoke tests with Javascript
yarn test