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

@hkk12369/jsonpath-lite

v1.0.1

Published

Lightweight, performance-focused JSONPath subset with TypeScript support

Readme

@hkk12369/jsonpath-lite

Lightweight, performance-focused JSONPath subset for Node.js with full TypeScript support.

~11× faster than jsonpath on typical queries. Zero dependencies.

Installation

npm install @hkk12369/jsonpath-lite

Quick start

import { query, compile } from '@hkk12369/jsonpath-lite';

const data = {
    store: {
        books: [
            { title: 'A', price: 8.95 },
            { title: 'B', price: 12.99 },
        ],
    },
};

// String path — convenient for one-off calls
query(data, '$.store.books[?(@.price > 10)]');
// → [{ title: 'B', price: 12.99 }]

// Pre-compiled path — parse once, reuse many times
const path = compile('$..books[?(@.price > 10)].title');
for (const record of records) {
    query(record, path);
}

Supported syntax

| Syntax | Description | |---|---| | $ | Root element | | .key | Child key access | | ..key | Recursive descent by key | | [n] | Array index | | ['key'] | Bracket key (allows special characters) | | [*] | Wildcard — all direct children | | .key* | Glob key — matches key, keyA, keyFoo, … | | .*key | Glob key — matches any key ending with key | | [?(...)] | Filter expression |

Filter operators

| Operator | Example | |---|---| | == === | [?(@.x == 1)] | | != !== | [?(@.x != null)] | | > >= < <= | [?(@.price >= 10)] | | like_regex | [?(@.name like_regex "^Jo")] | | like_regex with flags | [?(@.name like_regex "^jo" flag "i")] | | starts_with | [?(@.id starts_with "usr_")] | | ends_with | [?(@.file ends_with ".ts")] | | includes / contains | [?(@.tags contains "admin")] | | truthy (no operator) | [?(@.enabled)] | | ! && \|\| () | [?(@.a && (@.b > 1 \|\| [email protected]))] | | @key | Key of the element — use after [*] or ..* |

Path in filter (@. and @..)

  • @.field — direct child lookup
  • @..field — recursive lookup anywhere inside the node
  • @.a.b.c — chained path steps
  • @.a* — glob inside filter path
// Recursive lookup inside filter
query(data, '$..items[?(@..status == "active")]');

// @key — filter by key name
query(data, '$.*[?(@key starts_with "usr_")]');

Pre-compiling paths

Call compile() once and pass the result to query() to avoid re-parsing on every call:

import { compile, query, type CompiledPath } from '@hkk12369/jsonpath-lite';

const activePath: CompiledPath = compile('$..items[?(@.active)].name');

// Zero parsing overhead on each iteration
for (const record of largeDataset) {
    const names = query(record, activePath);
}

TypeScript

All exports are fully typed. query() returns unknown[]

const prices = query(data, '$..price') as number[];

The CompiledPath type is exported for storing pre-compiled paths in class fields or module-level constants.

License

MIT