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 🙏

© 2025 – Pkg Stats / Ryan Hefner

jsonpath-rfc9535

v1.0.0

Published

A JSONPath implementation based on RFC 9535

Downloads

16

Readme

jsonpath-rfc9535

A JSONPath implementation based on RFC 9535.

Works in any environment complying with ECMAScript 2022.

It passes the entire JSONPath Compliance Test Suite with 100% success rate (tested against commit 9277705).

If you are interested in a legacy specification, please check out my other package nimma.

Installation

To install the package, you can use npm:

npm install jsonpath-rfc9535

or a package manager of your choice.

Usage

import { query } from 'jsonpath-rfc9535';

const document = {
  "store": {
    "book": [
      {
        "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95,
      },
      {
        "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99,
      },
      {
        "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99,
      },
      {
        "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99,
      },
    ],
    "bicycle": {
      "color": "red",
      "price": 399,
    },
  },
};

const path = '$.store.book[*].author';
const result = query(document, path);

console.log(result); // Outputs: ['Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien']

You can also import exec member that takes a callback.

import { exec } from 'jsonpath-rfc9535';

const document = {
  // ...
}

const path = '$.store.book[*].author';
const result = exec(document, path, (value) => {
  // consume matched value
});

Parser

The parser is generated using Peggy. In the future, I would like to merge it with the Nimma's parser to shrink down the package size as well as improve the performance.

The parser can be imported as a standalone module:

import parse from 'jsonpath-rfc9535/parser';

const ast = parse('$.store.book[*].author');
// consume ast

Regular Expressions

Bear in mind that match and search functions accept regular expressions in the form of I-Regexp (RFC 9485). These regular expressions are largely compatible with the standard ECMAScript regular expressions, but there is one relatively minor difference. In I-Regexp, the dot (.) character matches any character except for \n and \r. On top of that, Unicode is enabled by default.

Custom Function Extensions

At the moment, custom function extensions are not supported. However, the API is designed to support them, so they might be added in the future if there is a demand for them.