🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

jsonpath-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonpath-js

An implementation of JSONPath

0.2.0
latest
Source
npm
Version published
Weekly downloads
7.3K
-18.14%
Maintainers
1
Weekly downloads
 
Created
Source

jsonpath-js

GitHub License NPM Version Link Checker

[!WARNING] This library is still in its initial development stage, so please be aware that the API is subject to change.

An implementation of RFC 9535 JSONPath

Features

  • 100% Compatible with RFC 9535

Supported Runtimes

  • Node v20+
  • Deno v2+
  • Bun v1.2+

Install

npm install jsonpath-js

Usage

import { JSONPathJS } from "jsonpath-js";

const query = new JSONPathJS("$.users[*].name");
const result = query.find({
  users: [{ name: "John Doe" }, { name: "Jane Doe" }],
});

// [ 'John Doe', 'Jane Doe' ]
console.log(result);


const pathResult = query.paths({
	users: [{ name: "John Doe" }, { name: "Jane Doe" }],
});

// [
// 	{ value: "John Doe", path: "$['users'][0]['name']" },
// 	{ value: "Jane Doe", path: "$['users'][1]['name']" },
// ];
console.log(pathResult);

Contributing

Please read the contributing guide.

Keywords

jsonpath

FAQs

Package last updated on 24 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts