Socket
Socket
Sign inDemoInstall

jsonpath-plus

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonpath-plus

A JS implementation of JSONPath with some additional operators


Version published
Weekly downloads
3.6M
decreased by-15.86%
Maintainers
1
Weekly downloads
 
Created

What is jsonpath-plus?

The jsonpath-plus npm package allows users to query and manipulate JSON documents using the JSONPath query language. It provides capabilities to extract data from JSON structures, manipulate the data, and even transform JSON data based on specific queries.

What are jsonpath-plus's main functionalities?

Querying JSON

This feature allows users to extract data from a JSON document based on a specified JSONPath query. The example provided demonstrates how to retrieve all authors from a list of books in a store.

const {JSONPath} = require('jsonpath-plus');
const result = JSONPath({path: '$.store.book[*].author', json: jsonDocument});
console.log(result);

Filtering results

This feature enables filtering elements of a JSON document that meet certain conditions. In the example, it filters books that have a price less than 10.

const {JSONPath} = require('jsonpath-plus');
const result = JSONPath({path: '$.store.book[?(@.price < 10)].title', json: jsonDocument});
console.log(result);

Using script expressions

This feature supports the use of script expressions within the JSONPath query to perform more complex queries. The example fetches the title of the last book in the list.

const {JSONPath} = require('jsonpath-plus');
const result = JSONPath({path: '$.store.book[(@.length-1)].title', json: jsonDocument});
console.log(result);

Other packages similar to jsonpath-plus

Keywords

FAQs

Package last updated on 24 Jun 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc