v0.2.0 — built with Bun + TypeScript

JSON that grep
can understand

jray flattens nested JSON into human-readable lines.
Filter by path. Extract subtrees. Reconstruct back.
Zero dependencies. Blazing fast.

Get started View on GitHub
$ npm install -g @siyadkc/jray

// live demo

See it in action

Four commands that cover everything jray does. Click any to explore further.

flatten — turn JSON into lines
$ jray data.json
json.organization.name = "Acme Corporation"
json.organization.founded = 2019
json.users[0].name = "Alice Pemberton"
json.users[0].role = "admin"
json.users[0].active = true
json.users[1].name = "Bob Nakamura"
json.billing.plan = "enterprise"
json.billing.seats = 25
json.featureFlags.darkMode = true
json.featureFlags.betaEditor = false
... and more
--filter — match by path, not value
# grep matches values too — jray --filter only matches paths
$ jray data.json --filter "billing"
json.billing.plan = "enterprise"
json.billing.seats = 25
json.billing.pricePerSeat = 49
json.billing.currency = "USD"
json.billing.paymentMethod.type = "card"
json.billing.paymentMethod.last4 = "4242"
--select — extract a subtree as JSON
$ jray data.json --select "organization.headquarters"
{
  "street": "221B Baker Street",
  "city": "London",
  "country": "GB",
  "coordinates": { "lat": 51.5237, "lng": -0.1585 }
}
--ungron — reconstruct JSON from flat lines
$ jray data.json | jray --ungron
# outputs the original JSON — perfectly reconstructed
{
  "organization": { ... },
  "users": [ ... ],
  "billing": { ... }
}
fetch from a URL directly
# no curl needed — jray fetches URLs directly
$ jray https://jsonplaceholder.typicode.com/users/1
json.name = "Leanne Graham"
json.email = "Sincere@april.biz"
json.address.city = "Gwenborough"
json.company.name = "Romaguera-Crona"
... and more

// why jray

Built for the command line

Everything you need to work with JSON in the terminal — nothing you don't.

Zero dependencies

Pure TypeScript. No bloated node_modules. Install it and it just works.

🔍

Path-aware filtering

Unlike grep, --filter only matches against paths — never accidentally matches values.

🔄

Fully reversible

Flatten and unflatten are perfect inverses. Your JSON comes back exactly as it went in.

📡

Stdin / stdout

Pipe it into anything. Works with curl, cat, grep, awk — your whole toolchain.

🦾

Built with Bun

Faster startup than Node. Native TypeScript. Modern runtime for a modern tool.

🌍

Open source — MIT

Free forever. Read the code, fork it, contribute. Built in public from day one.


// how it works

One line per value

Every leaf value in your JSON gets its own line with the full path shown.

anatomy of a jray line
json.users[0].preferences.theme = "dark"
json root prefix
users[0].preferences.theme full path
= delimiter
"dark" JSON-encoded value

// comparison

vs jq and gron

jray combines the best of both without requiring you to learn a query language.

Feature jray jq gron
Flatten JSON to lines
Reconstruct JSON
Filter by path
Extract subtree as JSON
No query language
Zero dependencies
TypeScript / modern codebase

// get started

Install in seconds

Pick your package manager. The command is the same after install.

install
# with npm
$ npm install -g @siyadkc/jray
# with bun
$ bun add -g @siyadkc/jray
# or clone and run locally
$ git clone https://github.com/siyadhkc/Jray
$ cd Jray && bun install && bun link
usage
$ jray data.json # flatten
$ jray data.json --filter "user" # filter by path
$ jray data.json --select "user" # extract as JSON
$ jray --ungron data.gron # reconstruct
$ cat data.json | jray --filter "tags" # pipe

Ready to make JSON
actually grep-able?

Open source. Zero dependencies. Built with Bun.

Star on GitHub See the demo