@jsonpath-tools/jsonpath
v1.0.0
Published
JSONPath (RFC 9535) query evaluation, analysis and editor services.
Downloads
915
Readme
@jsonpath-tools/jsonpath
JSONPath (RFC 9535) query evaluation, analysis and editor services.
Quickstart
Installation:
npm install @jsonpath-tools/jsonpathSelect nodes:
import { JSONPath } from "@jsonpath-tools/jsonpath";
const queryArgument = {
books: [
{ title: "1984", author: "George Orwell" },
{ title: "Epic of Gilgamesh", author: null },
{ title: "The Old Man and the Sea", author: "Ernest Hemingway" }
]
};
const nodes = JSONPath.select(`$.books[[email protected] != null].title`, queryArgument);Getting the selected values:
const values = nodes.toValues();Getting paths to the selected values:
const paths = nodes.toNormalizedPaths();